diff options
author | kpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-11-29 15:29:33 +0000 |
---|---|---|
committer | kpfleming <kpfleming@f38db490-d61c-443f-a65b-d21fe96a405b> | 2008-11-29 15:29:33 +0000 |
commit | bc729d661cc9f06743bbca398a6340029c7975e5 (patch) | |
tree | 0c50e9e344a11805bfd2a56caef7d8350f2156c4 /channels/misdn_config.c | |
parent | dde3f0f3c14d0d100be77dfd4986b796e5fef0e0 (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: http://svn.digium.com/svn/asterisk/trunk@159774 f38db490-d61c-443f-a65b-d21fe96a405b
Diffstat (limited to 'channels/misdn_config.c')
-rw-r--r-- | channels/misdn_config.c | 14 |
1 files changed, 8 insertions, 6 deletions
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 |