comparison cli-runopts.c @ 1256:506f7681d0f8 coverity

merge up to date
author Matt Johnston <matt@ucc.asn.au>
date Tue, 15 Mar 2016 22:45:43 +0800
parents 888e3d17e962
children 968be6f7cff6
comparison
equal deleted inserted replaced
1219:84cf9062718d 1256:506f7681d0f8
536 total += written; 536 total += written;
537 } 537 }
538 538
539 if (opts.recv_window != DEFAULT_RECV_WINDOW) 539 if (opts.recv_window != DEFAULT_RECV_WINDOW)
540 { 540 {
541 int written = snprintf(ret+total, len-total, "-W %d ", opts.recv_window); 541 int written = snprintf(ret+total, len-total, "-W %u ", opts.recv_window);
542 total += written; 542 total += written;
543 } 543 }
544 544
545 #ifdef ENABLE_CLI_PUBKEY_AUTH 545 #ifdef ENABLE_CLI_PUBKEY_AUTH
546 for (iter = cli_opts.privkeys->first; iter; iter = iter->next) 546 for (iter = cli_opts.privkeys->first; iter; iter = iter->next)
822 dropbear_exit("Bad TCP port in '%s'", origstr); 822 dropbear_exit("Bad TCP port in '%s'", origstr);
823 } 823 }
824 #endif 824 #endif
825 825
826 static int match_extendedopt(const char** strptr, const char *optname) { 826 static int match_extendedopt(const char** strptr, const char *optname) {
827 int seen_eq = 0;
827 int optlen = strlen(optname); 828 int optlen = strlen(optname);
828 const char *str = *strptr; 829 const char *str = *strptr;
829 830
831 while (isspace(*str)) {
832 ++str;
833 }
834
830 if (strncasecmp(str, optname, optlen) != 0) { 835 if (strncasecmp(str, optname, optlen) != 0) {
831 return DROPBEAR_FAILURE; 836 return DROPBEAR_FAILURE;
832 } 837 }
833 838
834 str += optlen; 839 str += optlen;
835 840
836 if (*str == '=') { 841 while (isspace(*str) || (!seen_eq && *str == '=')) {
837 *strptr = str+1; 842 if (*str == '=') {
838 return DROPBEAR_SUCCESS; 843 seen_eq = 1;
839 } else { 844 }
845 ++str;
846 }
847
848 if (str-*strptr == optlen) {
849 /* matched just a prefix of optname */
840 return DROPBEAR_FAILURE; 850 return DROPBEAR_FAILURE;
841 } 851 }
842 852
853 *strptr = str;
854 return DROPBEAR_SUCCESS;
843 } 855 }
844 856
845 static int parse_flag_value(const char *value) { 857 static int parse_flag_value(const char *value) {
846 if (strcmp(value, "yes") == 0 || strcmp(value, "true") == 0) { 858 if (strcmp(value, "yes") == 0 || strcmp(value, "true") == 0) {
847 return 1; 859 return 1;