commit 67750f916fdc0406f3ea9313993452d9148819e2
Author: FRIGN <[email protected]>
Date:   Thu Aug 14 13:58:36 2014 +0200

    check for len(reqbuf) = 0
    
    Probably never the case, but we want to cleanly catch this error
    instead of bringing up a segfault with reqbuf[-1].

diff --git a/quark.c b/quark.c
index 121ecee..4fb065d 100644
--- a/quark.c
+++ b/quark.c
@@ -273,7 +273,7 @@ responsedir(void) {
        size_t len = strlen(reqbuf);
        DIR *d;
 
-       if ((reqbuf[len - 1] != '/') && (len + 1 < MAXBUFLEN)) {
+       if (len && (reqbuf[len - 1] != '/') && (len + 1 < MAXBUFLEN)) {
                /* add directory terminator if necessary */
                reqbuf[len] = '/';
                reqbuf[len + 1] = 0;


Reply via email to