summaryrefslogtreecommitdiff
path: root/source3/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
commitbc112cc46d9dacf2d1cb105d99e1e01ec38c5fa6 (patch)
tree34756677f0b2ff58f15cea0526dd49dcdc0fc75b /source3/lib/util_unistr.c
parent8cd9636458e175d2e1b63a5211423cec04a6ce91 (diff)
downloadsamba-bc112cc46d9dacf2d1cb105d99e1e01ec38c5fa6.tar.gz
samba-bc112cc46d9dacf2d1cb105d99e1e01ec38c5fa6.tar.bz2
samba-bc112cc46d9dacf2d1cb105d99e1e01ec38c5fa6.zip
r20361: Prevent strnlen_w reading beyond max. Valgrind
found by Volker. Jeremy (This used to be commit 08d551163c9563bd02acd437bc1a1595e7939cee)
Diffstat (limited to 'source3/lib/util_unistr.c')
-rw-r--r--source3/lib/util_unistr.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/source3/lib/util_unistr.c b/source3/lib/util_unistr.c
index 84e4cf3f83..cf040a2dfc 100644
--- a/source3/lib/util_unistr.c
+++ b/source3/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++) {
;
}