FreeCalypso > hg > freecalypso-tools
comparison uptools/atcmd/smsend_main.c @ 965:2969032bdfac
fcup-smsend[mult]: fix buglet in K&R C NULL pointer passing
The only 100% safe way to pass a NULL pointer as a function argument
in K&R C is to cast 0 to a pointer type; failing to do so may cause
mysterious bugs (invalid stack frames or garbage in argument registers)
on 64-bit machines. This issue has already been fixed in most of
FC host tools, but I just found some missed spots: passing of NULL UDH
to PDU encoding functions in fcup-smsend[mult] in the case of single
(not concatenated) SMS.
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Fri, 01 Sep 2023 07:33:51 +0000 |
parents | dc2fd8e6f42c |
children | ec7e23d5151f |
comparison
equal
deleted
inserted
replaced
964:a96cb97b66a2 | 965:2969032bdfac |
---|---|
186 exit(ERROR_USAGE); | 186 exit(ERROR_USAGE); |
187 } | 187 } |
188 if (msgtext_gsmlen <= 160) { | 188 if (msgtext_gsmlen <= 160) { |
189 common_init(); | 189 common_init(); |
190 prep_for_pdu_mode(); | 190 prep_for_pdu_mode(); |
191 send_in_pdu_mode(dest_addr, msgtext_gsm7, msgtext_gsmlen, 0, 0); | 191 send_in_pdu_mode(dest_addr, msgtext_gsm7, msgtext_gsmlen, |
192 (u_char *) 0, 0); | |
192 if (sms_write_mode == 1) | 193 if (sms_write_mode == 1) |
193 sendafterwr_process(); | 194 sendafterwr_process(); |
194 if (concat_enable && !concat_quiet) | 195 if (concat_enable && !concat_quiet) |
195 printf("Message sent as single SMS\n"); | 196 printf("Message sent as single SMS\n"); |
196 exit(0); | 197 exit(0); |
247 exit(ERROR_USAGE); | 248 exit(ERROR_USAGE); |
248 } | 249 } |
249 if (msgtext_unilen <= 70) { | 250 if (msgtext_unilen <= 70) { |
250 common_init(); | 251 common_init(); |
251 prep_for_pdu_mode(); | 252 prep_for_pdu_mode(); |
252 send_pdu_ucs2(dest_addr, msgtext_uni, msgtext_unilen, 0, 0); | 253 send_pdu_ucs2(dest_addr, msgtext_uni, msgtext_unilen, |
254 (u_char *) 0, 0); | |
253 if (sms_write_mode == 1) | 255 if (sms_write_mode == 1) |
254 sendafterwr_process(); | 256 sendafterwr_process(); |
255 if (concat_enable && !concat_quiet) | 257 if (concat_enable && !concat_quiet) |
256 printf("Message sent as single SMS\n"); | 258 printf("Message sent as single SMS\n"); |
257 exit(0); | 259 exit(0); |