X-Git-Url: http://git.madism.org/?p=apps%2Fmadmutt.git;a=blobdiff_plain;f=snprintf.c;h=72c3d118e279e6eb09047dd0d4f811e5c4759c5b;hp=2a40c4f9f661e657761211104e007cfba3cf2133;hb=d19fed17e7ba2e634d6cf473f4eeafa16fac5495;hpb=df70e07e24add1869bcc9b7af2277d9d0c09a281 diff --git a/snprintf.c b/snprintf.c index 2a40c4f..72c3d11 100644 --- a/snprintf.c +++ b/snprintf.c @@ -47,8 +47,9 @@ #if !defined(HAVE_SNPRINTF) || !defined(HAVE_VSNPRINTF) #include -# include +#include #include +#include "lib/str.h" /* Define this as a fall through, HAVE_STDARG_H is probably already set */ @@ -400,7 +401,7 @@ static void fmtstr (char *buffer, size_t * currlen, size_t maxlen, value = ""; } - for (strln = 0; value[strln]; ++strln); /* strlen */ + for (strln = 0; value[strln]; ++strln); /* safe_strlen */ padlen = min - strln; if (padlen < 0) padlen = 0; @@ -687,7 +688,7 @@ int vsnprintf (char *str, size_t count, const char *fmt, va_list args) { str[0] = 0; dopr (str, count, fmt, args); - return (strlen (str)); + return (safe_strlen (str)); } #endif /* !HAVE_VSNPRINTF */ @@ -715,7 +716,7 @@ int snprintf (va_alist) (void) vsnprintf (str, count, fmt, ap); VA_END; - return (strlen (str)); + return (safe_strlen (str)); } #ifdef TEST_SNPRINTF @@ -766,7 +767,7 @@ int main (void) for (y = 0; fp_nums[y] != 0; y++) { snprintf (buf1, sizeof (buf1), fp_fmt[x], fp_nums[y]); sprintf (buf2, fp_fmt[x], fp_nums[y]); - if (strcmp (buf1, buf2)) { + if (safe_strcmp (buf1, buf2)) { printf ("snprintf doesn't match Format: %s\n\tsnprintf = %s\n\tsprintf = %s\n", /* __SPRINTF_CHECKED__ */ fp_fmt[x], buf1, buf2); fail++; @@ -778,7 +779,7 @@ int main (void) for (y = 0; int_nums[y] != 0; y++) { snprintf (buf1, sizeof (buf1), int_fmt[x], int_nums[y]); sprintf (buf2, int_fmt[x], int_nums[y]); - if (strcmp (buf1, buf2)) { + if (safe_strcmp (buf1, buf2)) { printf ("snprintf doesn't match Format: %s\n\tsnprintf = %s\n\tsprintf = %s\n", /* __SPRINTF_CHECKED__ */ int_fmt[x], buf1, buf2); fail++;