[asterisk-dev] [Code Review] 4263: Fix characters unjustly cast to unsigned int before printf formatting
wdoekes
reviewboard at asterisk.org
Tue Dec 16 05:45:30 CST 2014
-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://reviewboard.asterisk.org/r/4263/
-----------------------------------------------------------
(Updated Dec. 16, 2014, 11:45 a.m.)
Review request for Asterisk Developers and kmoore.
Changes
-------
s/1.8/11/ in description
Bugs: ASTERISK-24619
https://issues.asterisk.org/jira/browse/ASTERISK-24619
Repository: Asterisk
Description
-------
r413586 introduced changes (amongst others) like:
- out += sprintf(out, "%%%02X", (unsigned char) *ptr);
+ out += sprintf(out, "%%%02X", (unsigned) *ptr);
But for high-ascii, that results in lots of FF's, for example:
printf("%02X\n", (unsigned)("å"[0])); /* "FFFFFFC3" */
This changeset attempt to rectify those by using the 'hh' modifier:
$ man sprintf | grep hh -A4 | head -n4
hh A following integer conversion corresponds to a
signed char or unsigned char argument, or a follow‐
ing n conversion corresponds to a pointer to a
signed char argument.
I also replaced occurrences of 2.2x with 02x. They appear to be equal.
This issue was reported by Stefan27 on IRC.
Diffs
-----
/branches/11/utils/smsq.c 429611
/branches/11/utils/astman.c 429611
/branches/11/res/res_rtp_asterisk.c 429611
/branches/11/res/res_pktccops.c 429611
/branches/11/res/res_crypto.c 429611
/branches/11/res/pjproject/pjnath/src/pjnath/turn_sock.c 429611
/branches/11/res/pjproject/pjnath/src/pjnath/stun_msg_dump.c 429611
/branches/11/res/pjproject/pjnath/src/pjnath/stun_msg.c 429611
/branches/11/res/pjproject/pjnath/src/pjnath-test/stun.c 429611
/branches/11/res/pjproject/pjlib/src/pj/ssl_sock_dump.c 429611
/branches/11/res/pjproject/pjlib-util/src/pjlib-util-test/encryption.c 429611
/branches/11/pbx/dundi-parser.c 429611
/branches/11/main/utils.c 429611
/branches/11/main/udptl.c 429611
/branches/11/main/netsock.c 429611
/branches/11/main/manager.c 429611
/branches/11/main/loader.c 429611
/branches/11/channels/vcodecs.c 429611
/branches/11/channels/sig_pri.c 429611
/branches/11/channels/misdn/ie.c 429611
/branches/11/channels/iax2-parser.c 429611
/branches/11/channels/chan_unistim.c 429611
/branches/11/channels/chan_sip.c 429611
/branches/11/channels/chan_misdn.c 429611
/branches/11/channels/chan_iax2.c 429611
/branches/11/channels/chan_h323.c 429611
/branches/11/apps/app_sms.c 429611
/branches/11/apps/app_osplookup.c 429611
/branches/11/apps/app_getcpeid.c 429611
/branches/11/apps/app_adsiprog.c 429611
/branches/11/addons/ooh323c/src/printHandler.c 429611
Diff: https://reviewboard.asterisk.org/r/4263/diff/
Testing
-------
It compiles with gcc 4.8. Did not test with gcc 4.10 which was
the cause for the r413586 fixes.
Thanks,
wdoekes
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-dev/attachments/20141216/b62ad876/attachment.html>
More information about the asterisk-dev
mailing list