Skip to content

Commit 435650a

Browse files
authored
Fix "Out-of-bounds write" (#560)
Fixes: #541
1 parent 1798ada commit 435650a

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

linux/hid.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -454,7 +454,7 @@ static int parse_hid_vid_pid_from_uevent_path(const char *uevent_path, unsigned
454454
}
455455

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

460460
if (res < 0) {

0 commit comments

Comments
 (0)