s3:registry: fix invalid write in iconvert_talloc()
commitaa8c9ef1387d4a92ebcc03580bbb9a8a4bcb8320
authorMichael Adam <obnox@samba.org>
Fri, 4 Mar 2011 22:53:44 +0000 (4 23:53 +0100)
committerMichael Adam <obnox@samba.org>
Sat, 5 Mar 2011 00:31:33 +0000 (5 01:31 +0100)
treef50895f2fb4f0f43c0444f3c7c3b0d721350c784
parent7b4fc4d745d3286363d4627b7c6d93696269fd65
s3:registry: fix invalid write in iconvert_talloc()

For a non-preallocated dest-string and sourcestring of len < 2,
(one or both of the) final two two zero-bytes would be written
after the end of the allocated dest-string. The sourcelen did
not include the source string terminator. For longer strings,
this was not a problem because the dest-string would have been
reallocated in the convert-loop. This is fixed now by allocating
two extra bytes for the terminating 0-bytes that are needed anyways
in the initial allocation.

Pair-Programmed-With: Gregor Beck <gbeck@sernet.de>
source3/registry/reg_parse_internal.c