s3/smbd: Fix string buffer overflow causing heap corruption
commitb686b9152865e6ae864d417931fc4bde4184e5b4
authorSteven Danneman <steven.danneman@isilon.com>
Sat, 30 Jan 2010 21:29:23 +0000 (30 13:29 -0800)
committerFernando J V da Silva <fernandojvsilva@yahoo.com.br>
Thu, 4 Feb 2010 19:09:52 +0000 (4 17:09 -0200)
treef97d5941f0f9e7a1b2d3ae83383dff384878ae6a
parentf38d69f588babc367eac42dbe748f8feec72feb2
s3/smbd: Fix string buffer overflow causing heap corruption

The destname malloc size was not taking into account the 1 extra byte
needed if a string without a leading '/' was passed in and that slash
was added.

This would cause the '\0' byte to be written past the end of the
malloced destname string and corrupt whatever heap memory was there.

This problem would be hit if a share name was given in smb.conf without
a leading '/' and if it was the exact size of the allocated STRDUP memory
which in some implementations of malloc is a power of 2.
source3/smbd/service.c