Skip to content

Commit b71ae6d

Browse files
nvinsonDaniel Kiper
authored andcommitted
osdep/linux/ofpath: Correct path_size calculation
path_size is computed in part by taking the size of the format string. However, the format string contains conversion specifiers. These conversion specifiers are included in the size calculation resulting in a size calculation that is larger than it needs to be. This patch corrects that error by removing the conversion specifiers when computing path_size. Signed-off-by: Nicholas Vinson <nvinson234@gmail.com> Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
1 parent 675d858 commit b71ae6d

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

grub-core/osdep/linux/ofpath.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -507,7 +507,7 @@ check_sas (const char *sysfs_path, int *tgt, unsigned long int *sas_address)
507507
p_len = (int) (q - sysfs_path);
508508
ed_len = (int) (q - ed);
509509

510-
path_size = (p_len + ed_len + sizeof ("%s/sas_device/%s/phy_identifier"));
510+
path_size = (p_len + ed_len + sizeof ("/sas_device//phy_identifier"));
511511
path = xmalloc (path_size);
512512
snprintf (path, path_size, "%.*s/sas_device/%.*s/phy_identifier", p_len,
513513
sysfs_path, ed_len, ed);

0 commit comments

Comments
 (0)