From: Christophe CURIS <christophe.cu...@free.fr> The function is building strings from the directory names into an allocated buffer, but the function took time first to calculate the exact size needed for the resulting string, so the check on wstrlcat's result will never fail.
As we still use wstrlcat it is not possible to overrun the buffer, we would just return a truncated string in the list instead of return no list at all but the case where it would happen is impossible. This should fix Coverity #50111 (Resource leak) which was present in the code of one of the related early return. Signed-off-by: Christophe CURIS <christophe.cu...@free.fr> --- WINGs/wbrowser.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/WINGs/wbrowser.c b/WINGs/wbrowser.c index 4027c2e..0475611 100644 --- a/WINGs/wbrowser.c +++ b/WINGs/wbrowser.c @@ -781,11 +781,7 @@ WMArray *WMGetBrowserPaths(WMBrowser * bPtr) path = wmalloc(slen); /* ignore first `/' */ for (i = 0; i <= column; i++) { - if (wstrlcat(path, bPtr->pathSeparator, slen) >= slen) { - wfree(path); - WMFreeArray(paths); - return NULL; - } + wstrlcat(path, bPtr->pathSeparator, slen); if (i == column) { item = lastItem; } else { @@ -793,10 +789,7 @@ WMArray *WMGetBrowserPaths(WMBrowser * bPtr) } if (!item) break; - if (wstrlcat(path, item->text, slen) >= slen) { - wfree(path); - return NULL; - } + wstrlcat(path, item->text, slen); } WMAddToArray(paths, path); } -- 2.1.1 -- To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.