mirror of
https://github.com/osmarks/ngircd.git
synced 2025-08-04 21:03:47 +00:00
Fixed return values of our own implementation of strlcpy(). The code has
been taken from rsync and they fixed it, but we didn't until today :-/
This commit is contained in:
parent
26b0ddf200
commit
6c5f4beb53
@ -12,6 +12,10 @@
|
|||||||
|
|
||||||
ngIRCd CVSHEAD
|
ngIRCd CVSHEAD
|
||||||
|
|
||||||
|
- Fixed return values of our own implementation of strlcpy(). The code has
|
||||||
|
been taken from rsync and they fixed it, but we didn't until today :-/
|
||||||
|
It has only been used when the system didn't implement strlcpy by itself,
|
||||||
|
not on "modern" systems. Florian Westphal, <westphal@foo.fh-furtwangen.de>.
|
||||||
- Raised the maximum length of passwords to 20 characters.
|
- Raised the maximum length of passwords to 20 characters.
|
||||||
- Fixed a memory leak when resizing the connection pool and realloc()
|
- Fixed a memory leak when resizing the connection pool and realloc()
|
||||||
failed. Now we don't fall back to malloc(), which should be sane anyway.
|
failed. Now we don't fall back to malloc(), which should be sane anyway.
|
||||||
@ -557,4 +561,4 @@ ngIRCd 0.0.1, 31.12.2001
|
|||||||
|
|
||||||
|
|
||||||
--
|
--
|
||||||
$Id: ChangeLog,v 1.250 2005/01/17 13:01:34 alex Exp $
|
$Id: ChangeLog,v 1.251 2005/01/18 09:05:37 alex Exp $
|
||||||
|
@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
#include "portab.h"
|
#include "portab.h"
|
||||||
|
|
||||||
static char UNUSED id[] = "$Id: strlcpy.c,v 1.2 2002/12/26 14:34:11 alex Exp $";
|
static char UNUSED id[] = "$Id: strlcpy.c,v 1.3 2005/01/18 09:05:37 alex Exp $";
|
||||||
|
|
||||||
#include "imp.h"
|
#include "imp.h"
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
@ -61,12 +61,13 @@ strlcpy( CHAR *dst, CONST CHAR *src, size_t size )
|
|||||||
* always null terminates. */
|
* always null terminates. */
|
||||||
|
|
||||||
size_t len = strlen( src );
|
size_t len = strlen( src );
|
||||||
|
size_t ret = len;
|
||||||
|
|
||||||
if( size <= 0 ) return len;
|
if( size <= 0 ) return 0;
|
||||||
if( len >= size ) len = size - 1;
|
if( len >= size ) len = size - 1;
|
||||||
memcpy( dst, src, len );
|
memcpy( dst, src, len );
|
||||||
dst[len] = 0;
|
dst[len] = 0;
|
||||||
return len;
|
return ret;
|
||||||
} /* strlcpy */
|
} /* strlcpy */
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
Loading…
x
Reference in New Issue
Block a user