r23673: Check for integer wrap on incoming data.
authorJeremy Allison <jra@samba.org>
Mon, 2 Jul 2007 20:51:09 +0000 (20:51 +0000)
committerGerald (Jerry) Carter <jerry@samba.org>
Wed, 10 Oct 2007 17:23:45 +0000 (12:23 -0500)
Jeremy.

source/lib/util_reg_api.c

index 8668bd881759669fd31805cb960e6b0400a59d62..a4fb0261e310940b714332044c1efea483e3b2a6 100644 (file)
@@ -80,6 +80,12 @@ WERROR registry_pull_value(TALLOC_CTX *mem_ctx,
                        tmp[num_ucs2] = 0;
                }
 
+               if (length + 2 < length) {
+                       /* Integer wrap. */
+                       err = WERR_INVALID_PARAM;
+                       goto error;
+               }
+
                value->v.sz.len = convert_string_talloc(
                        value, CH_UTF16LE, CH_UNIX, tmp, length+2,
                        &value->v.sz.str, False);