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>
This commit is contained in:
parent
54a1eb7677
commit
c83cd879d4
1 changed files with 5 additions and 3 deletions
|
@ -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);
|
||||
|
||||
|
|
Loading…
Reference in a new issue