[hackers] [ubase] Bail out on path truncation || sin
commit 941ffd2aed35c05346c1c77ab3cbfcc75b8e494a
Author: sin <sin_AT_2f30.org>
Date: Fri Jun 27 11:47:03 2014 +0100
Bail out on path truncation
diff --git a/switch_root.c b/switch_root.c
index 49a49e7..7500f8f 100644
--- a/switch_root.c
+++ b/switch_root.c
_AT_@ -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
");
+ if (strlcat(path, dent->d_name, sizeof(path)) >= sizeof(path))
+ eprintf("path too long
");
delete_content(path, curdevice);
path[0] = 0;
Received on Fri Jun 27 2014 - 12:52:21 CEST
This archive was generated by hypermail 2.3.0
: Fri Jun 27 2014 - 13:00:10 CEST