diff options
author | Kevin P. Fleming <kpfleming@digium.com> | 2008-11-29 15:29:33 +0000 |
---|---|---|
committer | Kevin P. Fleming <kpfleming@digium.com> | 2008-11-29 15:29:33 +0000 |
commit | 9a7c28cd5aeb577740ccb37e9e740a177223a762 (patch) | |
tree | 0c50e9e344a11805bfd2a56caef7d8350f2156c4 /channels | |
parent | 445c5296da9c1dede150d945a6794e3085ad37e8 (diff) |
we can now build with -Wformat=2, which found a couple of real bugs
because SPRINTF() use non-literal format strings (which cannot be checked), move it into its own module so the rest of func_strings can benefit from format string checking
git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@159774 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'channels')
-rw-r--r-- | channels/misdn/ie.c | 4 | ||||
-rw-r--r-- | channels/misdn_config.c | 14 |
2 files changed, 10 insertions, 8 deletions
diff --git a/channels/misdn/ie.c b/channels/misdn/ie.c index fbd06d163..dc9802845 100644 --- a/channels/misdn/ie.c +++ b/channels/misdn/ie.c @@ -1347,7 +1347,7 @@ static void enc_ie_useruser(unsigned char **ntmode, msg_t *msg, int protocol, ch i = 0; while(i < user_len) { - if (MISDN_IE_DEBG) printf(debug+(i*3), " %02x", user[i]); + if (MISDN_IE_DEBG) sprintf(debug+(i*3), " %02x", user[i]); i++; } @@ -1393,7 +1393,7 @@ static void dec_ie_useruser(unsigned char *p, Q931_info_t *qi, int *protocol, ch i = 0; while(i < *user_len) { - if (MISDN_IE_DEBG) printf(debug+(i*3), " %02x", user[i]); + if (MISDN_IE_DEBG) sprintf(debug+(i*3), " %02x", user[i]); i++; } debug[i*3] = '\0'; diff --git a/channels/misdn_config.c b/channels/misdn_config.c index 12a742cf3..29723e17c 100644 --- a/channels/misdn_config.c +++ b/channels/misdn_config.c @@ -882,12 +882,14 @@ static int _parse (union misdn_cfg_pt *dest, const char *value, enum misdn_cfg_t break; case MISDN_CTYPE_INT: { - char *pat; - if (strchr(value,'x')) - pat="%x"; - else - pat="%d"; - if (sscanf(value, pat, &tmp)) { + int res; + + if (strchr(value,'x')) { + res = sscanf(value, "%x", &tmp); + } else { + res = sscanf(value, "%d", &tmp); + } + if (res) { dest->num = ast_malloc(sizeof(int)); memcpy(dest->num, &tmp, sizeof(int)); } else |