diff options
author | Darren Tucker <dtucker@zip.com.au> | 2004-09-21 21:32:12 +1000 |
---|---|---|
committer | Darren Tucker <dtucker@zip.com.au> | 2004-09-21 21:32:12 +1000 |
commit | 50fbb45dbd2f95f95c959dc03663b213b4aac2aa (patch) | |
tree | 66655d76fea3e969190862c8d05d9983fc5f6722 | |
parent | 623d92f0b2ce0205d0762147cd6ecac4f922f3de (diff) |
- (dtucker) [openbsd-compat/bsd-snprintf.c] Check for max length too.
ok djm@
-rw-r--r-- | ChangeLog | 6 | ||||
-rw-r--r-- | openbsd-compat/bsd-snprintf.c | 4 |
2 files changed, 7 insertions, 3 deletions
@@ -1,3 +1,7 @@ +20040921 + - (dtucker) [openbsd-compat/bsd-snprintf.c] Check for max length too. + ok djm@ + 20040912 - (djm) [loginrec.c] Start KNF and tidy up of this long-neglected file. No change in resultant binary @@ -1744,4 +1748,4 @@ - (djm) Trim deprecated options from INSTALL. Mention UsePAM - (djm) Fix quote handling in sftp; Patch from admorten AT umich.edu -$Id: ChangeLog,v 1.3552 2004/09/12 12:36:15 dtucker Exp $ +$Id: ChangeLog,v 1.3553 2004/09/21 11:32:12 dtucker Exp $ diff --git a/openbsd-compat/bsd-snprintf.c b/openbsd-compat/bsd-snprintf.c index e4d8a439..aea501c6 100644 --- a/openbsd-compat/bsd-snprintf.c +++ b/openbsd-compat/bsd-snprintf.c @@ -58,7 +58,7 @@ #include "includes.h" -RCSID("$Id: bsd-snprintf.c,v 1.7 2003/05/18 14:13:39 djm Exp $"); +RCSID("$Id: bsd-snprintf.c,v 1.8 2004/09/21 11:32:13 dtucker Exp $"); #if defined(BROKEN_SNPRINTF) /* For those with broken snprintf() */ # undef HAVE_SNPRINTF @@ -369,7 +369,7 @@ fmtstr(char *buffer, size_t *currlen, size_t maxlen, if (value == 0) value = "<NULL>"; - for (strln = 0; value[strln]; ++strln); /* strlen */ + for (strln = 0; strln <= max && value[strln]; ++strln); /* strlen */ padlen = min - strln; if (padlen < 0) padlen = 0; |