Ensure that path[0] == '\0' upon entry to delete_content()

As a quick fix, staticise path to ensure that it is zero-filled
upon initial entry to the function.

In rare cases there's a possible buffer overflow and/or path
mess up on the first call to strlcat() with path[0] != '\0'.

The proper fix is to utilize util/recurse.c but the traversal
order cannot be specified at the moment.

Expect a better fix in the future.
This commit is contained in:
sin 2014-06-27 11:44:06 +01:00
parent 32bc548228
commit b5c3bcda7d

View File

@ -17,7 +17,7 @@
static void
delete_content(const char *dir, dev_t curdevice)
{
char path[PATH_MAX];
static char path[PATH_MAX];
DIR *d;
struct stat st;
struct dirent *dent;