diff options
author | Jeremy Allison <jra@samba.org> | 2012-03-29 17:13:07 -0700 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2012-03-30 21:26:07 +0200 |
commit | 959516d61bc6ee7cdd12409dde0ec00044208f1b (patch) | |
tree | 7639ccf8ba796ca775ff89b6e329d37f53a3ff9a /source3/libads | |
parent | 60eb1621d2c3224a2c7e8bec947741446ecbc4b1 (diff) | |
download | samba-959516d61bc6ee7cdd12409dde0ec00044208f1b.tar.gz |
More strlcat/strlcpy truncate checks.
Diffstat (limited to 'source3/libads')
-rw-r--r-- | source3/libads/ads_struct.c | 11 |
1 files changed, 9 insertions, 2 deletions
diff --git a/source3/libads/ads_struct.c b/source3/libads/ads_struct.c index b6c8e995ed4..e6220fd320a 100644 --- a/source3/libads/ads_struct.c +++ b/source3/libads/ads_struct.c @@ -52,10 +52,17 @@ char *ads_build_path(const char *realm, const char *sep, const char *field, int return NULL; } - strlcpy(ret,field, len); + if (strlcpy(ret,field, len) >= len) { + /* Truncate ! */ + free(r); + return NULL; + } p=strtok_r(r, sep, &saveptr); if (p) { - strlcat(ret, p, len); + if (strlcat(ret, p, len) >= len) { + free(r); + return NULL; + } while ((p=strtok_r(NULL, sep, &saveptr)) != NULL) { int retval; |