GNU bug report logs -
#19154
[PATCH] Extend file size support in paste.
Previous Next
Full log
Message #5 received at submit <at> debbugs.gnu.org (full text, mbox):
The function paste_parallel just has to remember if there was a character
in a line at all, not how many. Changing size_t to a simple boolean
statement removes a possible overflow situation with 4 GB files on 32 bit
systems.
---
src/paste.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/src/paste.c b/src/paste.c
index 2ca75d0..630a9a6 100644
--- a/src/paste.c
+++ b/src/paste.c
@@ -235,7 +235,7 @@ paste_parallel (size_t nfiles, char **fnamptr)
{
int chr IF_LINT ( = 0); /* Input character. */
int err IF_LINT ( = 0); /* Input errno value. */
- size_t line_length = 0; /* Number of chars in line. */
+ bool foundchar = false; /* Found chars in a line. */
if (fileptr[i])
{
@@ -250,7 +250,7 @@ paste_parallel (size_t nfiles, char **fnamptr)
while (chr != EOF)
{
- line_length++;
+ foundchar = true;
if (chr == '\n')
break;
xputchar (chr);
@@ -259,7 +259,7 @@ paste_parallel (size_t nfiles, char **fnamptr)
}
}
- if (line_length == 0)
+ if (!foundchar)
{
/* EOF, read error, or closed file.
If an EOF or error, close the file. */
--
2.1.1
This bug report was last modified 6 years and 231 days ago.
Previous Next
GNU bug tracking system
Copyright (C) 1999 Darren O. Benham,
1997,2003 nCipher Corporation Ltd,
1994-97 Ian Jackson.