mirror of
https://github.com/libguestfs/libguestfs.git
synced 2026-03-22 07:03:38 +00:00
inspect: os-release: fix single-number version parsing (RHBZ#1321620)
Use the proper length modifier for asprintf, instead of a padding modifier. This fixes the parsing of versions in VERSION_ID which are a single number (i.e. "X" and not "X.Y", etc). Bug introduced with commit32d19e3289, but uncovered recently with the switch away from VLAs, i.e. commit07c496c53c.
This commit is contained in:
@@ -232,7 +232,7 @@ parse_os_release (guestfs_h *g, struct inspect_fs *fs, const char *filename)
|
||||
return -1;
|
||||
} else {
|
||||
CLEANUP_FREE char *buf =
|
||||
safe_asprintf (g, "%*s", (int) value_len, value);
|
||||
safe_asprintf (g, "%.*s", (int) value_len, value);
|
||||
major_version = guestfs_int_parse_unsigned_int (g, buf);
|
||||
/* Handle cases where VERSION_ID is not a number. */
|
||||
if (major_version != -1)
|
||||
|
||||
Reference in New Issue
Block a user