diff --git a/src/util-conf.c b/src/util-conf.c index f36bfbf088..a5fc0e2c95 100644 --- a/src/util-conf.c +++ b/src/util-conf.c @@ -74,7 +74,7 @@ TmEcode ConfigSetDataDirectory(char *name) size_t size = strlen(name) + 1; char tmp[size]; strlcpy(tmp, name, size); - if (tmp[size - 2] == '/') + if (size > 2 && tmp[size - 2] == '/') // > 2 to allow just / tmp[size - 2] = '\0'; return ConfSetFinal("default-data-dir", tmp) ? TM_ECODE_OK : TM_ECODE_FAILED;