From 2caded0decf90c67ac6c961abedd37c9e9cb7c97 Mon Sep 17 00:00:00 2001 From: Michael Jerris Date: Sun, 25 May 2008 15:22:16 +0000 Subject: [PATCH] Thu May 22 10:38:36 EDT 2008 Pekka.Pessi@nokia.com * auth_module.c: fixed klocwork issues git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@8637 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- libs/sofia-sip/.update | 2 +- .../libsofia-sip-ua/iptsec/auth_module.c | 23 ++++++++++--------- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/libs/sofia-sip/.update b/libs/sofia-sip/.update index 58edbe3b6c..f92f0bbd2e 100644 --- a/libs/sofia-sip/.update +++ b/libs/sofia-sip/.update @@ -1 +1 @@ -Sun May 25 11:21:21 EDT 2008 +Sun May 25 11:21:50 EDT 2008 diff --git a/libs/sofia-sip/libsofia-sip-ua/iptsec/auth_module.c b/libs/sofia-sip/libsofia-sip-ua/iptsec/auth_module.c index 0e4b08a87b..a4148b43d8 100644 --- a/libs/sofia-sip/libsofia-sip-ua/iptsec/auth_module.c +++ b/libs/sofia-sip/libsofia-sip-ua/iptsec/auth_module.c @@ -537,11 +537,10 @@ void auth_method_basic(auth_mod_t *am, if (n < 0 || n >= INT_MAX) continue; if (n >= upsize) { - upsize = n + 1; - userpass = realloc(userpass == buffer ? NULL : userpass, upsize); - if (userpass == NULL) - continue; - base64_d(userpass, upsize - 1, au->au_params[0]); + void *b = realloc(userpass == buffer ? NULL : userpass, upsize = n + 1); + if (b == NULL) + break; + base64_d(userpass = b, upsize - 1, au->au_params[0]); } userpass[n] = 0; if (!(pass = strchr(userpass, ':'))) @@ -1079,13 +1078,15 @@ int auth_readdb_internal(auth_mod_t *am, int always) if (!*pass || !*user) continue; - realm = ""; ident = ""; - - if ((realm = strchr(pass, ':'))) { + if ((realm = strchr(pass, ':'))) *realm++ = '\0'; - if ((ident = strchr(realm, ':'))) - *ident++ = '\0'; - } + else + realm = ""; + + if ((ident = strchr(realm, ':'))) + *ident++ = '\0'; + else + ident = ""; apw = fresh + i++;