From a1c317d0c87423f63c00809d17f44b22750cf05e Mon Sep 17 00:00:00 2001 From: Amos Jeffries Date: Tue, 9 Sep 2008 01:30:02 +1200 Subject: [PATCH] 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. --- helpers/basic_auth/MSNT/session.c | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) 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 */ -- 2.47.2