git://git.exim.org
/
exim.git
/ blobdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
|
commitdiff
|
tree
raw
|
inline
| side by side
Fix three issues highlighted by clang analyser.
[exim.git]
/
src
/
src
/
auths
/
spa.c
diff --git
a/src/src/auths/spa.c
b/src/src/auths/spa.c
index d69c2e4fe473f07a0ca2e5366784bd016e574b66..1abd657813b3d5d3d86fa550553675f49343ce5d 100644
(file)
--- a/
src/src/auths/spa.c
+++ b/
src/src/auths/spa.c
@@
-202,6
+202,11
@@
auth_vars[0] = expand_nstring[1] = msgbuf;
expand_nlength[1] = Ustrlen(msgbuf);
expand_nmax = 1;
expand_nlength[1] = Ustrlen(msgbuf);
expand_nmax = 1;
+/* clean up globals which aren't referenced, but still shouldn't be left
+pointing to stack memory */
+#define CLEANUP_RETURN(Code) do { auth_vars[0] = expand_nstring[1] = NULL; \
+ expand_nlength[1] = expand_nmax = 0; return (Code); } while (0);
+
debug_print_string(ablock->server_debug_string); /* customized debug */
/* look up password */
debug_print_string(ablock->server_debug_string); /* customized debug */
/* look up password */
@@
-213,13
+218,13
@@
if (clearpass == NULL)
{
DEBUG(D_auth) debug_printf("auth_spa_server(): forced failure while "
"expanding spa_serverpassword\n");
{
DEBUG(D_auth) debug_printf("auth_spa_server(): forced failure while "
"expanding spa_serverpassword\n");
-
return FAIL
;
+
CLEANUP_RETURN(FAIL)
;
}
else
{
DEBUG(D_auth) debug_printf("auth_spa_server(): error while expanding "
"spa_serverpassword: %s\n", expand_string_message);
}
else
{
DEBUG(D_auth) debug_printf("auth_spa_server(): error while expanding "
"spa_serverpassword: %s\n", expand_string_message);
-
return DEFER
;
+
CLEANUP_RETURN(DEFER)
;
}
}
}
}
@@
-234,11
+239,14
@@
if (memcmp(ntRespData,
((unsigned char*)responseptr)+IVAL(&responseptr->ntResponse.offset,0),
24) == 0)
/* success. we have a winner. */
((unsigned char*)responseptr)+IVAL(&responseptr->ntResponse.offset,0),
24) == 0)
/* success. we have a winner. */
+ {
+ int rc = auth_check_serv_cond(ablock);
+ CLEANUP_RETURN(rc);
+ }
/* Expand server_condition as an authorization check (PH) */
/* Expand server_condition as an authorization check (PH) */
- return auth_check_serv_cond(ablock);
-
return FAIL
;
+
CLEANUP_RETURN(FAIL)
;
}
}