From: Maxime Villard <rustyBSD@gmx.fr>

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
This commit is contained in:
Maxime Villard 2012-12-15 14:42:19 +00:00 committed by Carsten Haitzler
parent 534ae45303
commit 5ebf793f1b
1 changed files with 1 additions and 2 deletions

View File

@ -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 */