Skip to content

Commit

Permalink
Fix "Out-of-bounds write"
Browse files Browse the repository at this point in the history
Fixes: #541
  • Loading branch information
Youw committed May 21, 2023
1 parent 8a4618a commit 4c9aecf
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion linux/hid.c
Original file line number Diff line number Diff line change
Expand Up @@ -454,7 +454,7 @@ static int parse_hid_vid_pid_from_uevent_path(const char *uevent_path, unsigned
}

char buf[1024];
res = read(handle, buf, sizeof(buf));
res = read(handle, buf, sizeof(buf) - 1); /* -1 for '\0' at the end */
close(handle);

if (res < 0) {
Expand Down

0 comments on commit 4c9aecf

Please sign in to comment.