Fix "Out-of-bounds write" (#560)

Fixes: #541
This commit is contained in:
Ihor Dutchak 2023-05-22 13:08:36 +03:00 committed by GitHub
parent 1798adabb2
commit 435650a8fb
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -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) {