commit 6474eebf7cc43835889c573f0905530e4244e952 parent cf7487682de47853e36e36330ac80b0c0388562f Author: z3bra <willyatmailoodotorg> Date: Sun May 15 20:08:43 +12000 Fix segfault when no key is provided Diffstat:
sick.c | | | 10 | ++++++++++ |
diff --git a/sick.c b/sick.c @@ -17,6 +17,12 @@ enum { ACT_CHCK }; +enum { + ERR_NOKEY, + ERR_NOSIG, + ERR_NOMSG +}; + static void usage(); static size_t bufferize(char **buf, FILE *fp); static size_t extractmsg(unsigned char *msg[], char *buf); @@ -254,6 +260,10 @@ main(int argc, char *argv[]) usage(); }ARGEND; + if (key == NULL) { + return ERR_NOKEY; + } + if (!argc) { fp = stdin; switch (action) {