]> git.ipfire.org Git - thirdparty/squid.git/commitdiff
Use safe functions in session helper
authorAmos Jeffries <squid3@treenet.co.nz>
Thu, 4 Sep 2008 12:02:34 +0000 (00:02 +1200)
committerAmos Jeffries <squid3@treenet.co.nz>
Thu, 4 Sep 2008 12:02:34 +0000 (00:02 +1200)
Advanced testing reveals that the session helper does not use the
string-safe functions Squid should be using.

This patch corrects that and a bit of formatting fluff in the session
helper.

helpers/basic_auth/MSNT/session.c

index c92520fdd8afac2b611890319b3c9fc736d99fbf..66e9b6c3e91e046190380cdead6d6dbad63bb567 100644 (file)
@@ -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 */