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].
This commit is contained in:
FRIGN 2014-08-14 13:58:36 +02:00
parent 72d02aa5b1
commit 67750f916f

View file

@ -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;