On 4 November 2015 at 18:38, Alan Wehmann <alan.wehm...@gmail.com> wrote:
> In "install-info_orig_seq.c" the line:
>
> 1447              strncat (*outstr, line_out, offset_out);
>
> is where the error occurred.
>
> After some study I decided to try making sure that "line_out" is terminated 
> by a '\0' character, so I have the code in "install-info_altered_seq.c":
>
> 1465              line_out = (char *) realloc ((void *)line_out, 
> allocated_out+1);
> 1466              line_out[offset_out+1] = '\0';
>
> that adds a '\0' character to "line_out" and allocates space for it.
> This seemed to make the problem with “strncat” go away.

Assuming offset_out isn't too big (it wasn't as far as I could tell),
my best guess is that strncat is reading too far in the source array,
and extending its allocation prevents an error being signalled.

Diffs are preferred for showing the changes you made to code, for
example "cp install-info.c install-info-fixed.c", then edit
install-info-fixed.c, finally post the output of "diff -u
install-info.c install-info-fixed.c".

Reply via email to