summaryrefslogtreecommitdiff
path: root/openbsd-compat
diff options
context:
space:
mode:
authorDarren Tucker <dtucker@zip.com.au>2004-09-21 21:32:12 +1000
committerDarren Tucker <dtucker@zip.com.au>2004-09-21 21:32:12 +1000
commit50fbb45dbd2f95f95c959dc03663b213b4aac2aa (patch)
tree66655d76fea3e969190862c8d05d9983fc5f6722 /openbsd-compat
parent623d92f0b2ce0205d0762147cd6ecac4f922f3de (diff)
- (dtucker) [openbsd-compat/bsd-snprintf.c] Check for max length too.
ok djm@
Diffstat (limited to 'openbsd-compat')
-rw-r--r--openbsd-compat/bsd-snprintf.c4
1 files changed, 2 insertions, 2 deletions
diff --git a/openbsd-compat/bsd-snprintf.c b/openbsd-compat/bsd-snprintf.c
index e4d8a439a..aea501c6f 100644
--- a/openbsd-compat/bsd-snprintf.c
+++ b/openbsd-compat/bsd-snprintf.c
@@ -58,7 +58,7 @@
58 58
59#include "includes.h" 59#include "includes.h"
60 60
61RCSID("$Id: bsd-snprintf.c,v 1.7 2003/05/18 14:13:39 djm Exp $"); 61RCSID("$Id: bsd-snprintf.c,v 1.8 2004/09/21 11:32:13 dtucker Exp $");
62 62
63#if defined(BROKEN_SNPRINTF) /* For those with broken snprintf() */ 63#if defined(BROKEN_SNPRINTF) /* For those with broken snprintf() */
64# undef HAVE_SNPRINTF 64# undef HAVE_SNPRINTF
@@ -369,7 +369,7 @@ fmtstr(char *buffer, size_t *currlen, size_t maxlen,
369 if (value == 0) 369 if (value == 0)
370 value = "<NULL>"; 370 value = "<NULL>";
371 371
372 for (strln = 0; value[strln]; ++strln); /* strlen */ 372 for (strln = 0; strln <= max && value[strln]; ++strln); /* strlen */
373 padlen = min - strln; 373 padlen = min - strln;
374 if (padlen < 0) 374 if (padlen < 0)
375 padlen = 0; 375 padlen = 0;