aboutsummaryrefslogtreecommitdiffstats
path: root/sharkd_session.c
diff options
context:
space:
mode:
authorPascal Quantin <pascal@wireshark.org>2021-06-22 16:59:03 +0200
committerPascal Quantin <pascal@wireshark.org>2021-06-22 16:59:03 +0200
commit16f5269d545f2756955c2c885225f91b0bc3ed10 (patch)
treeac3188767e4944246dc207cd3eba344ba85490b9 /sharkd_session.c
parentd3173824649743f33cb74f8876fd2fb46582f6ef (diff)
sharkd: prevent a NULL pointer dereference (CID 1486264)
Diffstat (limited to 'sharkd_session.c')
-rw-r--r--sharkd_session.c6
1 files changed, 6 insertions, 0 deletions
diff --git a/sharkd_session.c b/sharkd_session.c
index 3c88feba80..6ffbc13702 100644
--- a/sharkd_session.c
+++ b/sharkd_session.c
@@ -4839,6 +4839,12 @@ sharkd_session_process(char *buf, const jsmntok_t *tokens, int count)
const char* tok_method = json_find_attr(buf, tokens, count, "method");
+ if (!tok_method) {
+ sharkd_json_error(
+ rpcid, -32601, NULL,
+ "No method found");
+ return;
+ }
if (!strcmp(tok_method, "load"))
sharkd_session_process_load(buf, tokens, count);
else if (!strcmp(tok_method, "status"))