ubase

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

commit 941ffd2aed35c05346c1c77ab3cbfcc75b8e494a
parent b5c3bcda7d37cbcad68ce841f9bcd679f12400f4
Author: sin <sin@2f30.org>
Date:   Fri, 27 Jun 2014 11:47:03 +0100

Bail out on path truncation

Diffstat:
Mswitch_root.c | 6++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/switch_root.c b/switch_root.c @@ -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;