libselinux: label: ensure specfile_list is NULL-terminated
Stephen Smalley
maintainerPATCH 1/1 libselinux: label: ensure specfile_list is NULL-terminated
selabel_digest_fini() walks the specfile_list until it reaches a NULL; we therefore need to ensure that there is always an extra NULL slot at the end.
Signed-off-by Stephen Smalley <[email protected]>
--- libselinux/src/label.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
libselinux/src/label.c +1 -1
@@ -70,7 +70,7 @@ selabel_is_digest_set(const struct selinux_opt *opts, unsigned n) goto err; digest->specfile_list = -calloc (DIGEST_FILES_MAX ,sizeof (char *)); +calloc (DIGEST_FILES_MAX +1 ,sizeof (char *));if (!digest->specfile_list) goto err;
Signature · 1 line
2.54.0
Quoted 6 lines · Stephen Smalley
selabel_digest_fini()walks thespecfile_listuntil it reaches a NULL; we therefore need to ensure that there is always an extra NULL slot at the end.Signed-off-by Stephen Smalley <[email protected]>
Acked-by James Carter <[email protected]>
Quoted 20 lines
--- libselinux/src/label.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)libselinux/src/label.c +1
-2@@ -70,7 +70,7 @@ selabel_is_digest_set(const struct selinux_opt *opts, unsigned n) goto err; digest->specfile_list = -calloc (DIGEST_FILES_MAX ,sizeof (char *)); +calloc (DIGEST_FILES_MAX +1 ,sizeof (char *));if (!digest->specfile_list) goto err; --2.54.0
Stephen Smalley
maintainerQuoted 11 lines · James Carter
Quoted 6 lines · Stephen Smalley
selabel_digest_fini()walks thespecfile_listuntil it reaches a NULL; we therefore need to ensure that there is always an extra NULL slot at the end.Signed-off-by Stephen Smalley <[email protected]>Acked-by James Carter <[email protected]>
Merged.
Quoted 21 lines
Quoted 21 lines
--- libselinux/src/label.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)libselinux/src/label.c +1
-2@@ -70,7 +70,7 @@ selabel_is_digest_set(const struct selinux_opt *opts, unsigned n) goto err; digest->specfile_list = -calloc (DIGEST_FILES_MAX ,sizeof (char *)); +calloc (DIGEST_FILES_MAX +1 ,sizeof (char *));if (!digest->specfile_list) goto err; --2.54.0