comparison uptools/atcmd/smsend_main.c @ 405:ed9b67e7e741

fcup-smsend: fixed bug in the handling of -W with no dest address argument The original code checked for argv[optind+1] when argv[optind] is NULL; on most systems this bogus code gets the first line of the environment, which is clearly not what we are after. Fixed the code to check argc instead.
author Mychaela Falconia <falcon@freecalypso.org>
date Sat, 11 Aug 2018 18:59:54 +0000
parents 40b1498ec39d
children dc2fd8e6f42c
comparison
equal deleted inserted replaced
404:c0716b2ddfce 405:ed9b67e7e741
90 } else if (parse_and_encode_dest_addr(argv[optind], dest_addr) < 0) { 90 } else if (parse_and_encode_dest_addr(argv[optind], dest_addr) < 0) {
91 fprintf(stderr, 91 fprintf(stderr,
92 "error: destination address argument is invalid\n"); 92 "error: destination address argument is invalid\n");
93 exit(ERROR_USAGE); 93 exit(ERROR_USAGE);
94 } 94 }
95 if (!argv[optind+1]) 95 if (argc < optind + 2)
96 return(0); 96 return(0);
97 if (strlen(argv[optind+1]) > MAX_MSG_CHARS*2) { 97 if (strlen(argv[optind+1]) > MAX_MSG_CHARS*2) {
98 fprintf(stderr, "error: message argument is too long\n"); 98 fprintf(stderr, "error: message argument is too long\n");
99 exit(ERROR_USAGE); 99 exit(ERROR_USAGE);
100 } 100 }