From: <arc...@us...> - 2013-02-15 00:45:43
|
Revision: 644 http://sourceforge.net/p/sipp/code/644 Author: arcady-91 Date: 2013-02-15 00:45:39 +0000 (Fri, 15 Feb 2013) Log Message: ----------- A better fix for compilation with -D_FORTIFY_SOURCE=2 gcc parameter See rhbz #559620 for details: https://bugzilla.redhat.com/559620 Signed-off-by: Peter Lemenkov <lem...@gm...> Modified Paths: -------------- sipp/trunk/auth.c Modified: sipp/trunk/auth.c =================================================================== --- sipp/trunk/auth.c 2013-02-15 00:45:28 UTC (rev 643) +++ sipp/trunk/auth.c 2013-02-15 00:45:39 UTC (rev 644) @@ -226,11 +226,10 @@ md5_byte_t resp[MD5_HASH_SIZE], body[MD5_HASH_SIZE]; unsigned char ha1_hex[HASH_HEX_SIZE+1], ha2_hex[HASH_HEX_SIZE+1]; unsigned char resp_hex[HASH_HEX_SIZE+1], body_hex[HASH_HEX_SIZE+1]; - char tmp[MAX_HEADER_LEN], authtype[16], cnonce[32], nc[32], opaque[64]; + char tmp[MAX_HEADER_LEN], tmp2[MAX_HEADER_LEN], authtype[16], cnonce[32], nc[32], opaque[64]; static unsigned int mync = 1; int has_opaque = 0; md5_state_t Md5Ctx; - char tmpbuf[2048]; // Extract the Auth Type - If not present, using 'none' cnonce[0] = '\0'; @@ -291,11 +290,11 @@ hashToHex(&ha2[0], &ha2_hex[0]); if (cnonce[0] != '\0') { - snprintf(tmpbuf, 2048, ",cnonce=\"%s\",nc=%s,qop=%s",cnonce,nc,authtype); - strcat(result,tmpbuf); + snprintf(tmp2, sizeof(tmp2), ",cnonce=\"%s\",nc=%s,qop=%s",cnonce,nc,authtype); + strcat(result,tmp2); } - snprintf(tmpbuf, 2048, ",uri=\"%s\"",tmp); - strcat(result,tmpbuf); + snprintf(tmp2, sizeof(tmp2), ",uri=\"%s\"",tmp); + strcat(result,tmp2); // Extract the Nonce if (!getAuthParameter("nonce", auth, tmp, sizeof(tmp))) { @@ -320,12 +319,12 @@ md5_finish(&Md5Ctx, resp); hashToHex(&resp[0], &resp_hex[0]); - snprintf(tmpbuf, 2048, ",nonce=\"%s\",response=\"%s\",algorithm=%s",tmp,resp_hex,algo); - strcat(result,tmpbuf); + snprintf(tmp2, sizeof(tmp2), ",nonce=\"%s\",response=\"%s\",algorithm=%s",tmp,resp_hex,algo); + strcat(result,tmp2); if (has_opaque) { - snprintf(tmpbuf, 2048, ",opaque=\"%s\"",opaque); - strcat(result,tmpbuf); + snprintf(tmp2, sizeof(tmp2), ",opaque=\"%s\"",opaque); + strcat(result,tmp2); } return 1; This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |