From: Adela0602 <53685844+Adela0602@users.noreply.github.com> Date: Sun, 4 Aug 2019 13:11:30 +0000 (+0800) Subject: Fix potential segmentation fault (SIGSEGV) error #209 (#210) X-Git-Url: http://git.prime8.dev/?a=commitdiff_plain;h=87a705223fd07390018811a5a220b862fb3678b3;p=ttyd.git Fix potential segmentation fault (SIGSEGV) error #209 (#210) --- diff --git a/src/server.c b/src/server.c index 87454af..cea5774 100644 --- a/src/server.c +++ b/src/server.c @@ -382,6 +382,10 @@ main(int argc, char **argv) { return -1; } char *value = strsep(&option, "="); + if (value == NULL) { + fprintf(stderr, "ttyd: invalid client option: %s, format: key=value\n", optarg); + return -1; + } free(option); struct json_object *obj = json_tokener_parse(value); json_object_object_add(client_prefs, key, obj != NULL ? obj : json_object_new_string(value));