[PATCH] build system: fix potential buffer overflow

Alyssa Ross via busybox <[email protected]>
Newsgroups gmane.linux.busybox
Message-ID <[email protected]>
This could potentially write one byte past the end of line.
Identified by fortify-headers.
---
 scripts/basic/split-include.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/scripts/basic/split-include.c b/scripts/basic/split-include.c
index 6ef29195e..93011d511 100644
--- a/scripts/basic/split-include.c
+++ b/scripts/basic/split-include.c
@@ -195,7 +195,7 @@ int main(int argc, const char * argv [])
 	ERROR_EXIT( "find" );
 
     line[0] = '\n';
-    while (fgets(line+1, buffer_size, fp_find))
+    while (fgets(line+1, buffer_size-1, fp_find))
     {
 	if (strstr(list_target, line) == NULL)
 	{
-- 
2.53.0
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.