summaryrefslogtreecommitdiffstats
path: root/init/init.h
diff options
context:
space:
mode:
authorSan Mehat <san@google.com>2009-05-14 14:54:22 -0700
committerSan Mehat <san@google.com>2009-05-14 15:08:04 -0700
commitc83cd879d45e667fbb4763f18c908928ee9d67d8 (patch)
tree938b1fa73b95efdf25325ab5a93dc744c7235e98 /init/init.h
parent54a1eb7677a10c1591ba48562ae480cd71721bf6 (diff)
downloadsystem_core-c83cd879d45e667fbb4763f18c908928ee9d67d8.zip
system_core-c83cd879d45e667fbb4763f18c908928ee9d67d8.tar.gz
system_core-c83cd879d45e667fbb4763f18c908928ee9d67d8.tar.bz2
init: Fix heap corruption for services with arguments
The 'args' array *must* be the last entry in the structure. This fixes a longstanding issue (apparently since tc3) where a service with an argument would corrupt the heap. The more arguments, the more corruption :|. This will probably also end up making key-code bound services more reliable (ie: bugreports triggered via the keyboard) Signed-off-by: San Mehat <san@google.com>
Diffstat (limited to 'init/init.h')
-rw-r--r--init/init.h8
1 files changed, 5 insertions, 3 deletions
diff --git a/init/init.h b/init/init.h
index c9363da..b93eb50 100644
--- a/init/init.h
+++ b/init/init.h
@@ -137,15 +137,17 @@ struct service {
struct socketinfo *sockets;
struct svcenvinfo *envvars;
- int nargs;
- char *args[1];
struct action onrestart; /* Actions to execute on restart. */
/* keycodes for triggering this service via /dev/keychord */
int *keycodes;
int nkeycodes;
int keychord_id;
-};
+
+ int nargs;
+ /* "MUST BE AT THE END OF THE STRUCT" */
+ char *args[1];
+}; /* ^-------'args' MUST be at the end of this struct! */
int parse_config_file(const char *fn);