From: Enlightenment S. <no-...@en...> - 2011-11-01 09:53:21
|
Log: Empower: Fixed unsafe strncap operations in empower. Patch by tcech http://trac.enlightenment.org/e/ticket/819. Thisk patch obviously fixes an issue with empower, though tbh, I disagree with the error-prone usage of a global variable here. Declaring it in the .h file is at best confusing. :| Author: tasn Date: 2011-11-01 02:53:14 -0700 (Tue, 01 Nov 2011) New Revision: 64604 Trac: http://trac.enlightenment.org/e/changeset/64604 Modified: trunk/empower/src/bin/elm/empower.c trunk/empower/src/bin/elm/empower_cb_elm.c Modified: trunk/empower/src/bin/elm/empower.c =================================================================== --- trunk/empower/src/bin/elm/empower.c 2011-11-01 07:14:19 UTC (rev 64603) +++ trunk/empower/src/bin/elm/empower.c 2011-11-01 09:53:14 UTC (rev 64604) @@ -39,8 +39,8 @@ { if(mode == SUDO || mode == SUDOPROG) { - strncat(cmd, " ", 1024); - strncat(cmd, *argv, 1024); + strncat(cmd, " ", sizeof(cmd) - strlen(cmd) - 1); + strncat(cmd, *argv, sizeof(cmd) - strlen(cmd) - 1); } } Modified: trunk/empower/src/bin/elm/empower_cb_elm.c =================================================================== --- trunk/empower/src/bin/elm/empower_cb_elm.c 2011-11-01 07:14:19 UTC (rev 64603) +++ trunk/empower/src/bin/elm/empower_cb_elm.c 2011-11-01 09:53:14 UTC (rev 64604) @@ -155,8 +155,8 @@ if(exec && e && strlen(e)) { elm_exit(); - strncat(cmd, " ", 1024); - strncat(cmd, e, 1024); + strncat(cmd, " ", sizeof(cmd) - strlen(cmd) - 1); + strncat(cmd, e, sizeof(cmd) - strlen(cmd) - 1); } else { |