gluon-mesh-vpn-fastd: fix respondd segfault under load (#2594)

When running "fastd -v" fails, line may be NULL, causing a segfault in
strncmp.
This commit is contained in:
Matthias Schiffer 2022-08-09 20:09:31 +02:00 committed by GitHub
parent fa123e56d4
commit 20eea9b9ca
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

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