From: Amos Jeffries Date: Mon, 8 Sep 2008 13:30:02 +0000 (+1200) Subject: Use safe functions in basic auth MSNT helper X-Git-Tag: SQUID_3_0_STABLE9~6 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a1c317d0c87423f63c00809d17f44b22750cf05e;p=thirdparty%2Fsquid.git Use safe functions in basic auth MSNT helper Advanced testing reveals that the helper does not use the string-safe functions Squid should be using. This patch corrects that and a bit of formatting fluff. --- diff --git a/helpers/basic_auth/MSNT/session.c b/helpers/basic_auth/MSNT/session.c index c92520fdd8..66e9b6c3e9 100644 --- a/helpers/basic_auth/MSNT/session.c +++ b/helpers/basic_auth/MSNT/session.c @@ -296,14 +296,12 @@ RFCNB_Hangup(struct RFCNB_Con *con_Handle) void RFCNB_Get_Error(char *buffer, int buf_len) { - if (RFCNB_saved_errno <= 0) { - sprintf(buffer, "%s", RFCNB_Error_Strings[RFCNB_errno]); + snprintf(buffer, (buf_len-1) ,"%s", RFCNB_Error_Strings[RFCNB_errno]); } else { - sprintf(buffer, "%s\n\terrno:%s", RFCNB_Error_Strings[RFCNB_errno], + snprintf(buffer, (buf_len-1), "%s\n\terrno:%s", RFCNB_Error_Strings[RFCNB_errno], strerror(RFCNB_saved_errno)); } - } /* Pick up the last error response and returns as a code */ @@ -311,9 +309,7 @@ RFCNB_Get_Error(char *buffer, int buf_len) int RFCNB_Get_Last_Error(void) { - return (RFCNB_errno); - } /* Pick up saved errno as well */