osmo-mslookup-client: fix dereferencing null

Fixes: CID#207543
Change-Id: Ia9ff5b2c767853dd00f577a7bc3583f408e061b5
This commit is contained in:
Oliver Smith 2020-01-13 15:11:53 +01:00
parent 544b15d3fa
commit 9e533f666d
1 changed files with 5 additions and 0 deletions

View File

@ -456,6 +456,11 @@ static int socket_read_cb(struct osmo_fd *ofd)
rxbuf[rc] = '\0';
query_with_timeout = strtok(rxbuf, "\r\n");
if (!query_with_timeout) {
print_error("ERROR: failed to read line from socket\n");
goto close;
}
at = strchr(query_with_timeout, '@');
query_str = at ? at + 1 : query_with_timeout;