Bail out on path truncation

This commit is contained in:
sin 2014-06-27 11:47:03 +01:00
parent b5c3bcda7d
commit 941ffd2aed
1 changed files with 4 additions and 2 deletions

View File

@ -36,8 +36,10 @@ delete_content(const char *dir, dev_t curdevice)
continue;
/* build path and dive deeper */
strlcat(path, dir, sizeof(path));
strlcat(path, dent->d_name, sizeof(path));
if (strlcat(path, dir, sizeof(path)) >= sizeof(path))
eprintf("path too long\n");
if (strlcat(path, dent->d_name, sizeof(path)) >= sizeof(path))
eprintf("path too long\n");
delete_content(path, curdevice);
path[0] = 0;