blockdev: use snprintf() rather than sprintf()
Signed-off-by: Karel Zak <kzak@redhat.com>
This commit is contained in:
parent
05c4b11d5e
commit
26266436c8
|
@ -442,7 +442,7 @@ static void report_all_devices(void)
|
|||
&ma, &mi, &sz, ptname) != 4)
|
||||
continue;
|
||||
|
||||
sprintf(device, "/dev/%s", ptname);
|
||||
snprintf(device, sizeof(device), "/dev/%s", ptname);
|
||||
report_device(device, 1);
|
||||
}
|
||||
|
||||
|
@ -479,12 +479,12 @@ static void report_device(char *device, int quiet)
|
|||
|
||||
if (ul_path_read_u64(pc, &start, "start") != 0)
|
||||
/* TRANSLATORS: Start sector not available. Max. 15 letters. */
|
||||
sprintf(start_str, "%15s", _("N/A"));
|
||||
snprintf(start_str, sizeof(start_str), "%15s", _("N/A"));
|
||||
}
|
||||
ul_unref_path(pc);
|
||||
}
|
||||
if (!*start_str)
|
||||
sprintf(start_str, "%15ju", start);
|
||||
snprintf(start_str, sizeof(start_str), "%15ju", start);
|
||||
|
||||
if (ioctl(fd, BLKROGET, &ro) == 0 &&
|
||||
ioctl(fd, BLKRAGET, &ra) == 0 &&
|
||||
|
|
Loading…
Reference in New Issue