Merge branch 'jm/maint-diff-words-with-sbe'
* jm/maint-diff-words-with-sbe: do not read beyond end of malloc'd buffer
This commit is contained in:
12
diff.c
12
diff.c
@ -1117,8 +1117,16 @@ static void fn_out_consume(void *priv, char *line, unsigned long len)
|
||||
emit_line(ecbdata->opt, plain, reset, line, len);
|
||||
fputs("~\n", ecbdata->opt->file);
|
||||
} else {
|
||||
/* don't print the prefix character */
|
||||
emit_line(ecbdata->opt, plain, reset, line+1, len-1);
|
||||
/*
|
||||
* Skip the prefix character, if any. With
|
||||
* diff_suppress_blank_empty, there may be
|
||||
* none.
|
||||
*/
|
||||
if (line[0] != '\n') {
|
||||
line++;
|
||||
len--;
|
||||
}
|
||||
emit_line(ecbdata->opt, plain, reset, line, len);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user