diff options
author | pancake <pancake@flubox> | 2008-12-19 19:39:27 +0100 |
---|---|---|
committer | pancake <pancake@flubox> | 2008-12-19 19:39:27 +0100 |
commit | a6ef73359c0e0537ebf83795ebacbbfaee2c9c28 (patch) | |
tree | 1db2cc7c531927be96c581e4077500918ad45ac4 /src/qmode.c | |
parent | 3a1053b29e5fb8109463259ee9dff3d8f4e4be5b (diff) | |
download | 0xFFFF-a6ef73359c0e0537ebf83795ebacbbfaee2c9c28.tar.bz2 |
* Apply security patches from Erik Hovland - Thanks!
Diffstat (limited to 'src/qmode.c')
-rw-r--r-- | src/qmode.c | 49 |
1 files changed, 22 insertions, 27 deletions
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); } |