From a6ef73359c0e0537ebf83795ebacbbfaee2c9c28 Mon Sep 17 00:00:00 2001 From: pancake Date: Fri, 19 Dec 2008 19:39:27 +0100 Subject: * Apply security patches from Erik Hovland - Thanks! --- src/qmode.c | 49 ++++++++++++++++++++++--------------------------- 1 file changed, 22 insertions(+), 27 deletions(-) (limited to 'src/qmode.c') diff --git a/src/qmode.c b/src/qmode.c index d8c22db..cf52866 100644 --- a/src/qmode.c +++ b/src/qmode.c @@ -43,38 +43,33 @@ void process_message(char *msg) { char *str; char *arg; - int c=1; if (msg == NULL) return; printf("[x] (%s)\n", msg); str = strdup(msg); arg = strchr(str, ':'); - if (c!=0) { - arg[0]='\0'; - arg = arg +1; - if (!strcmp(str, "flash")) { - const char *type = fpid_file(arg); - if (type == NULL) { - squeue_push2(p, "error", "Unknown piece format", 1); - } else flash_image(arg, type, NULL); - } else - if (!strcmp(str, "reset")) { - if (reboot_board() == 0) { - squeue_push2(p,"info", "Device reboots", 1); - } else squeue_push2(p,"error", "Cannot reboot device", 1); - } else - if (!strcmp(str, "info")) { - get_rd_flags(); - squeue_push2(p, "info", strbuf, 1); - get_nolo_version(); - squeue_push2(p, "info", strbuf, 1); - get_usb_mode(); - squeue_push2(p, "info", strbuf, 1); - } else - squeue_push2(p, "error", "invalid command", 0); - } else { - squeue_push2(p, "error", "invalid command format", 0); - } + arg[0]='\0'; + arg = arg +1; + if (!strcmp(str, "flash")) { + const char *type = fpid_file(arg); + if (type == NULL) { + squeue_push2(p, "error", "Unknown piece format", 1); + } else flash_image(arg, type, NULL); + } else + if (!strcmp(str, "reset")) { + if (reboot_board() == 0) { + squeue_push2(p,"info", "Device reboots", 1); + } else squeue_push2(p,"error", "Cannot reboot device", 1); + } else + if (!strcmp(str, "info")) { + get_rd_flags(); + squeue_push2(p, "info", strbuf, 1); + get_nolo_version(); + squeue_push2(p, "info", strbuf, 1); + get_usb_mode(); + squeue_push2(p, "info", strbuf, 1); + } else + squeue_push2(p, "error", "invalid command", 0); free(str); } -- cgit v1.2.3