udev: ensure tag parsing stays within bounds

This cannot actually happen, but add a safety check nonetheless.

Reported on yeswehack.com as:
YWH-PGM9780-43

Follow-up for d7867b3183
This commit is contained in:
Luca Boccassi
2026-03-10 21:29:14 +00:00
parent 69e4ba69d6
commit 45a200cd75
+1 -1
View File
@@ -654,7 +654,7 @@ static void add_id_tag(UdevEvent *event, const char *path) {
size_t i = 0;
/* compose valid udev tag name */
for (const char *p = path; *p; p++) {
for (const char *p = path; *p && i < sizeof(tag) - 1; p++) {
if (ascii_isdigit(*p) ||
ascii_isalpha(*p) ||
*p == '-') {