View | Details | Raw Unified | Return to bug 224842 | Differences between
and this patch

Collapse All | Expand All

(-)usr.bin/patch/inp.c (-2 / +5 lines)
Lines 213-220 Link Here
213
	/* now scan the buffer and build pointer array */
213
	/* now scan the buffer and build pointer array */
214
	iline = 1;
214
	iline = 1;
215
	i_ptr[iline] = i_womp;
215
	i_ptr[iline] = i_womp;
216
	/* test for NUL too, to maintain the behavior of the original code */
216
	/*
217
	for (s = i_womp, i = 0; i < i_size && *s != '\0'; s++, i++) {
217
	 * Testing for NUL here actively breaks files that innocently use NUL
218
	 * for other reasons. mmap(2) succeeded, just scan the whole buffer.
219
	 */
220
	for (s = i_womp, i = 0; i < i_size; s++, i++) {
218
		if (*s == '\n') {
221
		if (*s == '\n') {
219
			if (iline == lines_allocated) {
222
			if (iline == lines_allocated) {
220
				if (!reallocate_lines(&lines_allocated))
223
				if (!reallocate_lines(&lines_allocated))

Return to bug 224842