From 8fea91ecaada25df855b1ed484613aef4664d284 Mon Sep 17 00:00:00 2001 From: Luke Bratch Date: Fri, 29 Oct 2010 18:03:59 +0100 Subject: Perform command length check when parsing configuration file --- blasms.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'blasms.c') diff --git a/blasms.c b/blasms.c index 0967170..2a70b25 100644 --- a/blasms.c +++ b/blasms.c @@ -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")) { -- cgit v1.2.3