suckless linux base utils
git clone git://git.2f30.org/ubase.git
Log | Files | Refs | README | LICENSE

commit b5c3bcda7d37cbcad68ce841f9bcd679f12400f4
parent 32bc54822823b97aa2e4e314bc68c48c708376dd
Author: sin <sin@2f30.org>
Date:   Fri Jun 27 11:44:06 +0100

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.

switch_root.c | 2+-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/switch_root.c b/switch_root.c @@ -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;