Skip to content

Commit

Permalink
Fix: check return from sscanf
Browse files Browse the repository at this point in the history
  • Loading branch information
JNE committed Dec 1, 2024
1 parent 045c2eb commit 4ec1908
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/kovid.c
Original file line number Diff line number Diff line change
Expand Up @@ -490,14 +490,14 @@ static ssize_t write_cb(struct file *fptr, const char __user *user,
kv_show_all_tasks();
break;
case Opt_hide_task_backdoor:
if (sscanf(args[0].from, "%d", &pid))
if (sscanf(args[0].from, "%d", &pid) == 1)
kv_hide_task_by_pid(pid, 1, CHILDREN);
break;
case Opt_list_hidden_tasks:
kv_show_saved_tasks();
break;
case Opt_rename_hidden_task:
if (sscanf(args[0].from, "%d", &pid))
if (sscanf(args[0].from, "%d", &pid) == 1)
kv_rename_task(pid, args[1].from);
break;
case Opt_hide_module:
Expand Down Expand Up @@ -560,7 +560,7 @@ static ssize_t write_cb(struct file *fptr, const char __user *user,
break;
case Opt_fetch_base_address:
{
if (sscanf(args[0].from, "%d", &pid)) {
if (sscanf(args[0].from, "%d", &pid) == 1) {
unsigned long base;
char bits[32+1] = {0};
base = kv_get_elf_vm_start(pid);
Expand Down

0 comments on commit 4ec1908

Please sign in to comment.