From 5ebf793f1b38cffda20850dae7ffa29391ba228d Mon Sep 17 00:00:00 2001 From: Maxime Villard Date: Sat, 15 Dec 2012 14:42:19 +0000 Subject: [PATCH] From: Maxime Villard Subject: [E-devel] [e] Patch acpi A little patch to fix a possible warning - and overflow. 'buf' is PATH_MAX, but PATH_MAX is not necessary 1024. If PATH_MAX < 1024 -> overflow. Also, fgets() fills the buffer and nullterminate it, so we don't need to buff[0] = '\0'. SVN revision: 81024 --- src/bin/e_acpi.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/bin/e_acpi.c b/src/bin/e_acpi.c index 028f573d5..d2b86f5ab 100644 --- a/src/bin/e_acpi.c +++ b/src/bin/e_acpi.c @@ -345,8 +345,7 @@ _e_acpi_lid_status_get(const char *device, const char *bus) } /* read the line from state file */ - buff[0] = '\0'; - ret = fgets(buff, 1024, f); + ret = fgets(buff, sizeof(buff), f); fclose(f); /* parse out state file */