1
0
mirror of https://github.com/gryf/wmaker.git synced 2025-12-23 06:38:05 +01:00

WMaker: fix dangerous code in file scanning for wAdvancedInputDialog (Coverity #50172)

As pointer by Coverity, the function wstrappend may move the string in
memory (because that's what realloc does if it can't expand the allocated
buffer in-place), so it is important to use the returned address and not
assume the old pointer is still valid.

Signed-off-by: Christophe CURIS <christophe.curis@free.fr>
This commit is contained in:
Christophe CURIS
2014-05-20 21:46:45 +02:00
committed by Carlos R. Mafra
parent 32c8dc04ce
commit bec0272584

View File

@@ -275,7 +275,7 @@ ScanFiles(const char *dir, const char *prefix, unsigned acceptmask, unsigned dec
de->d_name + prefixlen) == WANotFound) {
suffix = wstrdup(de->d_name + prefixlen);
if (sb.st_mode & S_IFDIR)
wstrappend(suffix,"/");
suffix = wstrappend(suffix, "/");
WMAddToArray(result, suffix);
}
wfree(fullfilename);