+/*
+ * Copyright (C) 1996-2017 The Squid Software Foundation and contributors
+ *
+ * Squid software is distributed under GPLv2+ license and includes
+ * contributions from numerous individuals and organizations.
+ * Please see the COPYING and CONTRIBUTORS files for details.
+ */
+
/* UNIX SMBlib NetBIOS implementation
Version 1.0
SMBlib Error values etc ...
Copyright (C) Richard Sharpe, Andrew Tridgell, and Merik Karman, 1996
-
*/
/*
/* ensure we don't overwrite strings when not passed enough space. Also */
/* added code to say unknown error codes if we see any */
-
-#include <stdio.h>
+#include "squid.h"
typedef struct {
char *name;
strncpy(msg_buf, err_classes[i].class, len);
strncat(msg_buf, " - ", len - strlen(msg_buf));
- sprintf(internal_buf, "%d", err_code);
+ snprintf(internal_buf, sizeof(internal_buf)-1, "%d", err_code);
strncat(msg_buf, internal_buf, len - strlen(msg_buf));
strncat(msg_buf, " (Unknown error code).", len - strlen(msg_buf));
strncpy(msg_buf, err_classes[i].class, len);
strncat(msg_buf, " - ", len - strlen(msg_buf));
- sprintf(internal_buf, "%d", err_code);
+ snprintf(internal_buf, sizeof(internal_buf)-1, "%d", err_code);
strncat(msg_buf, internal_buf, len - strlen(msg_buf));
return(strlen(msg_buf));
/* If we get here, we did not recognize the error class */
- sprintf(internal_buf, "%d", err_class);
+ snprintf(internal_buf, sizeof(internal_buf)-1, "%d", err_class);
strncat(msg_buf, internal_buf, len - strlen(msg_buf));
strncat(msg_buf, " (Unknown Error Class) - ", len - strlen(msg_buf));
- sprintf(internal_buf, "%d", err_code);
+ snprintf(internal_buf, sizeof(internal_buf)-1, "%d", err_code);
strncat(msg_buf, internal_buf, len - strlen(msg_buf));
strncat(msg_buf, "(error code).", len - strlen(msg_buf));
return(strlen(msg_buf));
}
+