[klibc] [PATCH 4/7] fstype: check_for_modules() check snprintf() return value
maximilian attems
max at stro.at
Tue Jul 5 11:06:29 PDT 2011
Signed-off-by: maximilian attems <max at stro.at>
---
usr/kinit/fstype/fstype.c | 5 ++++-
1 files changed, 4 insertions(+), 1 deletions(-)
diff --git a/usr/kinit/fstype/fstype.c b/usr/kinit/fstype/fstype.c
index 9f0f931..3f8dac0 100644
--- a/usr/kinit/fstype/fstype.c
+++ b/usr/kinit/fstype/fstype.c
@@ -161,7 +161,10 @@ static int check_for_modules(const char *fs_name)
if (uname(&uts))
return 0;
- snprintf(buf, sizeof(buf), "/lib/modules/%s/modules.dep", uts.release);
+ i = snprintf(buf, sizeof(buf), "/lib/modules/%s/modules.dep",
+ uts.release);
+ if (i >= sizeof(buf))
+ return 0;
f = fopen(buf, "r");
if (!f)
--
1.7.5.4
More information about the klibc
mailing list