summaryrefslogtreecommitdiffstats
path: root/source/lib/util_unistr.c
diff options
context:
space:
mode:
authorJeremy Allison <jra@samba.org>2006-12-27 18:36:00 +0000
committerGerald (Jerry) Carter <jerry@samba.org>2007-10-10 12:16:44 -0500
commit08d551163c9563bd02acd437bc1a1595e7939cee (patch)
treefe0ce67ee4e37040e327f029f54e75cab2f61f1b /source/lib/util_unistr.c
parent7977fd78652897bb7d4db1c21c5749043428f911 (diff)
downloadsamba-08d551163c9563bd02acd437bc1a1595e7939cee.tar.gz
samba-08d551163c9563bd02acd437bc1a1595e7939cee.tar.xz
samba-08d551163c9563bd02acd437bc1a1595e7939cee.zip
r20361: Prevent strnlen_w reading beyond max. Valgrind
found by Volker. Jeremy
Diffstat (limited to 'source/lib/util_unistr.c')
-rw-r--r--source/lib/util_unistr.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/source/lib/util_unistr.c b/source/lib/util_unistr.c
index 84e4cf3f83e..cf040a2dfc0 100644
--- a/source/lib/util_unistr.c
+++ b/source/lib/util_unistr.c
@@ -484,7 +484,7 @@ size_t strnlen_w(const smb_ucs2_t *src, size_t max)
size_t len;
smb_ucs2_t c;
- for(len = 0; *(COPY_UCS2_CHAR(&c,src)) && (len < max); src++, len++) {
+ for(len = 0; (len < max) && *(COPY_UCS2_CHAR(&c,src)); src++, len++) {
;
}