projects
/
ostree.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
e9a2a2c
)
zipl: NUL terminate buffer we're searching
author
Colin Walters
<walters@verbum.org>
Thu, 14 Dec 2023 13:03:01 +0000
(08:03 -0500)
committer
Colin Walters
<walters@verbum.org>
Thu, 14 Dec 2023 13:03:01 +0000
(08:03 -0500)
Found by a static analyzer.
src/libostree/ostree-bootloader-zipl.c
patch
|
blob
|
history
diff --git
a/src/libostree/ostree-bootloader-zipl.c
b/src/libostree/ostree-bootloader-zipl.c
index d6fb7ebd3e29bb6604a13a6be9f5d5de0c978bc9..0329eb658c3c9ac585bce477baf0e8fda05b7fe9 100644
(file)
--- a/
src/libostree/ostree-bootloader-zipl.c
+++ b/
src/libostree/ostree-bootloader-zipl.c
@@
-149,9
+149,10
@@
_ostree_secure_boot_is_enabled (gboolean *out_enabled, GCancellable *cancellable
while (*out_enabled != TRUE && max_lines > 0)
{
char buf[1024];
- ssize_t len = TEMP_FAILURE_RETRY (read (fd, buf, sizeof (buf)));
+ ssize_t len = TEMP_FAILURE_RETRY (read (fd, buf, sizeof (buf)
- 1
));
if (len < 0)
break;
+ buf[len] = '\0';
*out_enabled = strstr (buf, "Secure-IPL enabled") != NULL;
--max_lines;
}