From: Christophe CURIS <christophe.cu...@free.fr>

In the function 'wdefaultspathfordomain' there was a check to make sure the
generated path would fit in the allocated area, but this allocated area is
sized precisely to fit the path, so it cannot fail.

In the function 'getCurrentFileName' there were checks to make sure the
generated result string would fit in the allocated area, but this allocated
area is sized precisely to fit the path, so it cannot fail.

Signed-off-by: Christophe CURIS <christophe.cu...@free.fr>
---
 WINGs/userdefaults.c | 11 ++++-------
 WINGs/wfilepanel.c   | 15 +++------------
 2 files changed, 7 insertions(+), 19 deletions(-)

diff --git a/WINGs/userdefaults.c b/WINGs/userdefaults.c
index 876371d..6b55e8c 100644
--- a/WINGs/userdefaults.c
+++ b/WINGs/userdefaults.c
@@ -90,13 +90,10 @@ char *wdefaultspathfordomain(const char *domain)
        slen = strlen(gspath) + strlen(DEFAULTS_DIR) + strlen(domain) + 4;
        path = wmalloc(slen);
 
-       if (wstrlcpy(path, gspath, slen) >= slen ||
-           wstrlcat(path, DEFAULTS_DIR, slen) >= slen ||
-           wstrlcat(path, "/", slen) >= slen ||
-           wstrlcat(path, domain, slen) >= slen) {
-               wfree(path);
-               return NULL;
-       }
+       strcpy(path, gspath);
+       strcat(path, DEFAULTS_DIR);
+       strcat(path, "/");
+       strcat(path, domain);
 
        return path;
 }
diff --git a/WINGs/wfilepanel.c b/WINGs/wfilepanel.c
index 6dc8bab..0f12819 100644
--- a/WINGs/wfilepanel.c
+++ b/WINGs/wfilepanel.c
@@ -823,23 +823,14 @@ static char *getCurrentFileName(WMFilePanel * panel)
        slen = strlen(path) + strlen(file) + 1;
        ret = wmalloc(slen);
 
-       if (*file != '/' &&
-           wstrlcat(ret, path, slen) >= slen)
-               goto error;
+       if (file[0] != '/')
+               strcpy(ret, path);
 
-       if (wstrlcat(ret, file, slen) >= slen)
-               goto error;
+       strcat(ret, file);
 
        wfree(file);
        wfree(path);
        return ret;
-
-error:
-       wfree(file);
-       wfree(path);
-       wfree(ret);
-
-       return NULL;
 }
 
 
-- 
1.9.2


-- 
To unsubscribe, send mail to wmaker-dev-unsubscr...@lists.windowmaker.org.

Reply via email to