1
0
mirror of https://github.com/samba-team/samba.git synced 2025-01-19 10:03:58 +03:00

use strnlen to prevent coredumps

(This used to be commit 1960a650c1546323708ed6bea615dc7215a97b4f)
This commit is contained in:
Jim McDonough 2003-03-19 20:50:43 +00:00
parent a666912f7b
commit e542eedd18

View File

@ -495,7 +495,7 @@ char *safe_strcpy_fn(const char *fn, int line, char *dest,const char *src, size_
return dest;
}
len = strlen(src);
len = strnlen(src, maxlength+1);
if (len > maxlength) {
DEBUG(0,("ERROR: string overflow by %u (%u - %u) in safe_strcpy [%.50s]\n",
@ -524,8 +524,8 @@ char *safe_strcat_fn(const char *fn, int line, char *dest, const char *src, size
if (!src)
return dest;
src_len = strlen(src);
dest_len = strlen(dest);
src_len = strnlen(src, maxlength + 1);
dest_len = strnlen(dest, maxlength + 1);
clobber_region(fn, line, dest + dest_len, maxlength + 1 - dest_len);