gluon-mesh-vpn-fastd: fix respondd segfault under load

When running "fastd -v" fails, line may be NULL, causing a segfault in
strncmp.

(cherry picked from commit 8dd0f32c18)
This commit is contained in:
Matthias Schiffer 2022-08-06 18:52:49 +02:00 committed by github-actions[bot]
parent 0c17f5fb8b
commit 77dfea9cdd

View File

@ -65,7 +65,7 @@ static struct json_object * get_fastd_version(void) {
}
const char *version = line;
if (strncmp(version, "fastd ", 6) == 0)
if (version && strncmp(version, "fastd ", 6) == 0)
version += 6;
struct json_object *ret = gluonutil_wrap_string(version);