diff options
author | Luke Bratch <l_bratch@yahoo.co.uk> | 2010-10-29 18:03:59 +0100 |
---|---|---|
committer | Luke Bratch <l_bratch@yahoo.co.uk> | 2010-10-29 18:03:59 +0100 |
commit | 8fea91ecaada25df855b1ed484613aef4664d284 (patch) | |
tree | 442014284d909df92948df3e79aa9ccc9cf30025 | |
parent | e5bda37c582ce5b18baebbb852c59da69bf6b7ea (diff) |
Perform command length check when parsing configuration file
-rw-r--r-- | blasms.c | 6 |
1 files changed, 5 insertions, 1 deletions
@@ -126,7 +126,7 @@ int main(int argc, char *argv[]) { /* SMS content */ char sms[500]; /* SMS command */ - char smscommand[8]; + char smscommand[9]; /* Command to execute */ char systemcmd[1000]; /* Default command to execute */ @@ -210,6 +210,10 @@ int main(int argc, char *argv[]) { //printf("%s\n", line); if ((strchrp = strchr(line, ' ')) != NULL) { offset = strchrp - line; + if (offset > 8) { + printf("Error, command longer than 8 characters in blasms.conf.\n"); + return 1; + } strxfrm(configcmd, line, offset); configcmd[offset] = '\0'; if (!strcmp(configcmd, "default")) { |