[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: problem using install-info with tar.info
From: |
Alan Wehmann |
Subject: |
Re: problem using install-info with tar.info |
Date: |
Sat, 7 Nov 2015 15:19:46 -0600 |
If I have the following:
if (c == '\n')
{
line_out[offset_out++] = c;
line_out = (char *) realloc ((void *)line_out, allocated_out+1);
/* line_out[offset_out+1] = '\0'; */
strncat (*outstr, line_out, offset_out);
column = offset_out = 0;
continue;
}
then there is no Abort trap: 6 error and the dir file is written.
I checked again that the error occurs if both my added lines are not there, and
that it does not occur if both my added lines are present.
The error also occurs with:
if (c == '\n')
{
line_out[offset_out++] = c;
/* line_out = (char *) realloc ((void *)line_out, allocated_out+1); */
line_out[offset_out+1] = '\0';
strncat (*outstr, line_out, offset_out);
column = offset_out = 0;
continue;
}
Alan Wehmann
address@hidden
On Nov 7, 2015, at 9:23 AM, Gavin Smith <address@hidden> wrote:
On 7 November 2015 at 14:54, Alan Wehmann <address@hidden> wrote:
Here is the Diff output:
diff -u install-info.c install-info-fixed.c
--- install-info.c 2015-02-27 12:57:27.000000000 -0600
+++ install-info-fixed.c 2015-11-07 08:48:36.000000000 -0600
@@ -1445,6 +1445,8 @@
if (c == '\n')
{
line_out[offset_out++] = c;
+ line_out = (char *) realloc ((void *)line_out, allocated_out+1);
+ line_out[offset_out+1] = '\0';
strncat (*outstr, line_out, offset_out);
column = offset_out = 0;
continue;
What happens if you take the "line_out[offset_out+1] = '\0'" line out
but leave the realloc in? Does it work for the test file or does it
break again?