summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
6ff4253)
Fix udev_rules_apply_format() to give error messages for unknown
format elements and pass such elements to the output string
unmodified.
When truncating the substitution string to the length specified in the
format string, head[len] = '\0' could write outside the buffer if that
length was too large.
+ head[0] = '$';
+ err("unknown format variable '%s'", head);
} else if (head[0] == '%') {
/* substitute format char */
if (head[1] == '\0')
} else if (head[0] == '%') {
/* substitute format char */
if (head[1] == '\0')
+ head[0] = '%';
+ err("unknown format char '%c'", tail[0]);
break;
}
/* possibly truncate to format-char specified length */
break;
}
/* possibly truncate to format-char specified length */
+ if (len >= 0 && len < (int)strlen(head)) {
head[len] = '\0';
dbg("truncate to %i chars, subtitution string becomes '%s'", len, head);
}
head[len] = '\0';
dbg("truncate to %i chars, subtitution string becomes '%s'", len, head);
}