mirror of
https://github.com/gryf/wmaker.git
synced 2025-12-22 22:28:02 +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:
committed by
Carlos R. Mafra
parent
32c8dc04ce
commit
bec0272584
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user