From 87a705223fd07390018811a5a220b862fb3678b3 Mon Sep 17 00:00:00 2001 From: Adela0602 <53685844+Adela0602@users.noreply.github.com> Date: Sun, 4 Aug 2019 21:11:30 +0800 Subject: [PATCH] Fix potential segmentation fault (SIGSEGV) error #209 (#210) --- src/server.c | 4 ++++ 1 file changed, 4 insertions(+) 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)); -- 2.43.4