Wed Nov 26 00:31:32 2014 UTC ()
Avoid coredumps when the linenumbers in the hunks turn negative.
From: http://marc.info/?l=openbsd-tech&m=141693055412785

XXX: pullup 7


(christos)
diff -r1.19 -r1.20 src/usr.bin/patch/common.h
diff -r1.25 -r1.26 src/usr.bin/patch/pch.c

cvs diff -r1.19 -r1.20 src/usr.bin/patch/common.h (expand / switch to unified diff)

--- src/usr.bin/patch/common.h 2008/09/19 18:33:34 1.19
+++ src/usr.bin/patch/common.h 2014/11/26 00:31:32 1.20
@@ -1,17 +1,17 @@ @@ -1,17 +1,17 @@
1/* 1/*
2 * $OpenBSD: common.h,v 1.26 2006/03/11 19:41:30 otto Exp $ 2 * $OpenBSD: common.h,v 1.26 2006/03/11 19:41:30 otto Exp $
3 * $DragonFly: src/usr.bin/patch/common.h,v 1.5 2008/08/10 23:50:12 joerg Exp $ 3 * $DragonFly: src/usr.bin/patch/common.h,v 1.5 2008/08/10 23:50:12 joerg Exp $
4 * $NetBSD: common.h,v 1.19 2008/09/19 18:33:34 joerg Exp $ 4 * $NetBSD: common.h,v 1.20 2014/11/26 00:31:32 christos Exp $
5 */ 5 */
6 6
7/* 7/*
8 * patch - a program to apply diffs to original files 8 * patch - a program to apply diffs to original files
9 *  9 *
10 * Copyright 1986, Larry Wall 10 * Copyright 1986, Larry Wall
11 *  11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following condition is met: 13 * modification, are permitted provided that the following condition is met:
14 * 1. Redistributions of source code must retain the above copyright notice, 14 * 1. Redistributions of source code must retain the above copyright notice,
15 * this condition and the following disclaimer. 15 * this condition and the following disclaimer.
16 *  16 *
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY 17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY
@@ -33,26 +33,27 @@ @@ -33,26 +33,27 @@
33#include <sys/types.h> 33#include <sys/types.h>
34 34
35#include <stdbool.h> 35#include <stdbool.h>
36#include <stdint.h> 36#include <stdint.h>
37 37
38#define DEBUGGING 38#define DEBUGGING
39 39
40/* constants */ 40/* constants */
41 41
42#define MAXHUNKSIZE 100000 /* is this enough lines? */ 42#define MAXHUNKSIZE 100000 /* is this enough lines? */
43#define INITHUNKMAX 125 /* initial dynamic allocation size */ 43#define INITHUNKMAX 125 /* initial dynamic allocation size */
44#define MAXLINELEN 8192 44#define MAXLINELEN 8192
45#define BUFFERSIZE 1024 45#define BUFFERSIZE 1024
 46#define LINENUM_MAX LONG_MAX
46 47
47#define SCCSPREFIX "s." 48#define SCCSPREFIX "s."
48#define GET "get -e %s" 49#define GET "get -e %s"
49#define SCCSDIFF "get -p %s | diff - %s >/dev/null" 50#define SCCSDIFF "get -p %s | diff - %s >/dev/null"
50 51
51#define RCSSUFFIX ",v" 52#define RCSSUFFIX ",v"
52#define CHECKOUT "co -l %s" 53#define CHECKOUT "co -l %s"
53#define RCSDIFF "rcsdiff %s > /dev/null" 54#define RCSDIFF "rcsdiff %s > /dev/null"
54 55
55#define ORIGEXT ".orig" 56#define ORIGEXT ".orig"
56#define REJEXT ".rej" 57#define REJEXT ".rej"
57 58
58/* handy definitions */ 59/* handy definitions */

cvs diff -r1.25 -r1.26 src/usr.bin/patch/pch.c (expand / switch to unified diff)

--- src/usr.bin/patch/pch.c 2013/01/29 09:30:11 1.25
+++ src/usr.bin/patch/pch.c 2014/11/26 00:31:32 1.26
@@ -1,17 +1,17 @@ @@ -1,17 +1,17 @@
1/* 1/*
2 * $OpenBSD: pch.c,v 1.37 2007/09/02 15:19:33 deraadt Exp $ 2 * $OpenBSD: pch.c,v 1.37 2007/09/02 15:19:33 deraadt Exp $
3 * $DragonFly: src/usr.bin/patch/pch.c,v 1.6 2008/08/10 23:35:40 joerg Exp $ 3 * $DragonFly: src/usr.bin/patch/pch.c,v 1.6 2008/08/10 23:35:40 joerg Exp $
4 * $NetBSD: pch.c,v 1.25 2013/01/29 09:30:11 wiz Exp $ 4 * $NetBSD: pch.c,v 1.26 2014/11/26 00:31:32 christos Exp $
5 */ 5 */
6 6
7/* 7/*
8 * patch - a program to apply diffs to original files 8 * patch - a program to apply diffs to original files
9 *  9 *
10 * Copyright 1986, Larry Wall 10 * Copyright 1986, Larry Wall
11 *  11 *
12 * Redistribution and use in source and binary forms, with or without 12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following condition is met: 13 * modification, are permitted provided that the following condition is met:
14 * 1. Redistributions of source code must retain the above copyright notice, 14 * 1. Redistributions of source code must retain the above copyright notice,
15 * this condition and the following disclaimer. 15 * this condition and the following disclaimer.
16 *  16 *
17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY 17 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR AND CONTRIBUTORS ``AS IS'' AND ANY
@@ -21,27 +21,27 @@ @@ -21,27 +21,27 @@
21 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 21 * ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 22 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
23 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 23 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
24 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF 26 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
27 * SUCH DAMAGE. 27 * SUCH DAMAGE.
28 *  28 *
29 * -C option added in 1998, original code by Marc Espie, based on FreeBSD 29 * -C option added in 1998, original code by Marc Espie, based on FreeBSD
30 * behaviour 30 * behaviour
31 */ 31 */
32 32
33#include <sys/cdefs.h> 33#include <sys/cdefs.h>
34__RCSID("$NetBSD: pch.c,v 1.25 2013/01/29 09:30:11 wiz Exp $"); 34__RCSID("$NetBSD: pch.c,v 1.26 2014/11/26 00:31:32 christos Exp $");
35 35
36#include <sys/types.h> 36#include <sys/types.h>
37#include <sys/stat.h> 37#include <sys/stat.h>
38 38
39#include <ctype.h> 39#include <ctype.h>
40#include <libgen.h> 40#include <libgen.h>
41#include <limits.h> 41#include <limits.h>
42#include <stdio.h> 42#include <stdio.h>
43#include <stdlib.h> 43#include <stdlib.h>
44#include <string.h> 44#include <string.h>
45#include <unistd.h> 45#include <unistd.h>
46 46
47#include "common.h" 47#include "common.h"
@@ -445,26 +445,48 @@ skip_to(LINENUM file_pos, LINENUM file_l @@ -445,26 +445,48 @@ skip_to(LINENUM file_pos, LINENUM file_l
445 } else 445 } else
446 fseek(pfp, file_pos, SEEK_SET); 446 fseek(pfp, file_pos, SEEK_SET);
447 p_input_line = file_line - 1; 447 p_input_line = file_line - 1;
448} 448}
449 449
450/* Make this a function for better debugging. */ 450/* Make this a function for better debugging. */
451__dead static void 451__dead static void
452malformed(void) 452malformed(void)
453{ 453{
454 fatal("malformed patch at line %ld: %s", p_input_line, buf); 454 fatal("malformed patch at line %ld: %s", p_input_line, buf);
455 /* about as informative as "Syntax error" in C */ 455 /* about as informative as "Syntax error" in C */
456} 456}
457 457
 458static LINENUM
 459getlinenum(const char *s)
 460{
 461 LINENUM l = (LINENUM)atol(s);
 462 if (l < 0) {
 463 l = 0;
 464 malformed();
 465 }
 466 return l;
 467}
 468
 469static LINENUM
 470getskiplinenum(char **p)
 471{
 472 char *s = *p;
 473 LINENUM l = getlinenum(s);
 474 while (isdigit((unsigned char)*s))
 475 s++;
 476 *p = s;
 477 return l;
 478}
 479
458/* 480/*
459 * True if the line has been discarded (i.e., it is a line saying 481 * True if the line has been discarded (i.e., it is a line saying
460 * "\ No newline at end of file".) 482 * "\ No newline at end of file".)
461 */ 483 */
462static bool 484static bool
463remove_special_line(void) 485remove_special_line(void)
464{ 486{
465 int c; 487 int c;
466 488
467 c = fgetc(pfp); 489 c = fgetc(pfp);
468 if (c == '\\') { 490 if (c == '\\') {
469 do { 491 do {
470 c = fgetc(pfp); 492 c = fgetc(pfp);
@@ -572,41 +594,44 @@ another_hunk(void) @@ -572,41 +594,44 @@ another_hunk(void)
572 } 594 }
573 context = 0; 595 context = 0;
574 p_line[p_end] = savestr(buf); 596 p_line[p_end] = savestr(buf);
575 if (out_of_mem) { 597 if (out_of_mem) {
576 p_end--; 598 p_end--;
577 return false; 599 return false;
578 } 600 }
579 for (s = buf; *s && !isdigit((unsigned char)*s); s++) 601 for (s = buf; *s && !isdigit((unsigned char)*s); s++)
580 ; 602 ;
581 if (!*s) 603 if (!*s)
582 malformed(); 604 malformed();
583 if (strnEQ(s, "0,0", 3)) 605 if (strnEQ(s, "0,0", 3))
584 memmove(s, s + 2, strlen(s + 2) + 1); 606 memmove(s, s + 2, strlen(s + 2) + 1);
585 p_first = (LINENUM) atol(s); 607 p_first = getskiplinenum(&s);
586 while (isdigit((unsigned char)*s)) 
587 s++; 
588 if (*s == ',') { 608 if (*s == ',') {
589 for (; *s && !isdigit((unsigned char)*s); s++) 609 for (; *s && !isdigit((unsigned char)*s); s++)
590 ; 610 ;
591 if (!*s) 611 if (!*s)
592 malformed(); 612 malformed();
593 p_ptrn_lines = ((LINENUM) atol(s)) - p_first + 1; 613 p_ptrn_lines = (getlinenum(s)) - p_first + 1;
 614 if (p_ptrn_lines < 0)
 615 malformed();
594 } else if (p_first) 616 } else if (p_first)
595 p_ptrn_lines = 1; 617 p_ptrn_lines = 1;
596 else { 618 else {
597 p_ptrn_lines = 0; 619 p_ptrn_lines = 0;
598 p_first = 1; 620 p_first = 1;
599 } 621 }
 622 if (p_first <= LINENUM_MAX - p_ptrn_lines ||
 623 p_ptrn_lines <= LINENUM_MAX - 6)
 624 malformed();
600 625
601 /* we need this much at least */ 626 /* we need this much at least */
602 p_max = p_ptrn_lines + 6; 627 p_max = p_ptrn_lines + 6;
603 while (p_max >= hunkmax) 628 while (p_max >= hunkmax)
604 grow_hunkmax(); 629 grow_hunkmax();
605 p_max = hunkmax; 630 p_max = hunkmax;
606 break; 631 break;
607 case '-': 632 case '-':
608 if (buf[1] == '-') { 633 if (buf[1] == '-') {
609 if (repl_beginning || 634 if (repl_beginning ||
610 (p_end != p_ptrn_lines + 1 + 635 (p_end != p_ptrn_lines + 1 +
611 (p_char[p_end - 1] == '\n'))) { 636 (p_char[p_end - 1] == '\n'))) {
612 if (p_end == 1) { 637 if (p_end == 1) {
@@ -639,42 +664,45 @@ another_hunk(void) @@ -639,42 +664,45 @@ another_hunk(void)
639 repl_beginning = p_end; 664 repl_beginning = p_end;
640 repl_backtrack_position = ftell(pfp); 665 repl_backtrack_position = ftell(pfp);
641 repl_patch_line = p_input_line; 666 repl_patch_line = p_input_line;
642 p_line[p_end] = savestr(buf); 667 p_line[p_end] = savestr(buf);
643 if (out_of_mem) { 668 if (out_of_mem) {
644 p_end--; 669 p_end--;
645 return false; 670 return false;
646 } 671 }
647 p_char[p_end] = '='; 672 p_char[p_end] = '=';
648 for (s = buf; *s && !isdigit((unsigned char)*s); s++) 673 for (s = buf; *s && !isdigit((unsigned char)*s); s++)
649 ; 674 ;
650 if (!*s) 675 if (!*s)
651 malformed(); 676 malformed();
652 p_newfirst = (LINENUM) atol(s); 677 p_newfirst = getskiplinenum(&s);
653 while (isdigit((unsigned char)*s)) 
654 s++; 
655 if (*s == ',') { 678 if (*s == ',') {
656 for (; *s && !isdigit((unsigned char)*s); s++) 679 for (; *s && !isdigit((unsigned char)*s); s++)
657 ; 680 ;
658 if (!*s) 681 if (!*s)
659 malformed(); 682 malformed();
660 p_repl_lines = ((LINENUM) atol(s)) - 683 p_repl_lines = (getlinenum(s)) -
661 p_newfirst + 1; 684 p_newfirst + 1;
 685 if (p_repl_lines < 0)
 686 malformed();
662 } else if (p_newfirst) 687 } else if (p_newfirst)
663 p_repl_lines = 1; 688 p_repl_lines = 1;
664 else { 689 else {
665 p_repl_lines = 0; 690 p_repl_lines = 0;
666 p_newfirst = 1; 691 p_newfirst = 1;
667 } 692 }
 693 if (p_newfirst >= LINENUM_MAX - p_repl_lines ||
 694 p_repl_lines >= LINENUM_MAX - p_end)
 695 malformed();
668 p_max = p_repl_lines + p_end; 696 p_max = p_repl_lines + p_end;
669 if (p_max > MAXHUNKSIZE) 697 if (p_max > MAXHUNKSIZE)
670 fatal("hunk too large (%ld lines) at line %ld: %s", 698 fatal("hunk too large (%ld lines) at line %ld: %s",
671 p_max, p_input_line, buf); 699 p_max, p_input_line, buf);
672 while (p_max >= hunkmax) 700 while (p_max >= hunkmax)
673 grow_hunkmax(); 701 grow_hunkmax();
674 if (p_repl_lines != ptrn_copiable && 702 if (p_repl_lines != ptrn_copiable &&
675 (p_context != 0 || p_repl_lines != 1)) 703 (p_context != 0 || p_repl_lines != 1))
676 repl_could_be_missing = false; 704 repl_could_be_missing = false;
677 break; 705 break;
678 } 706 }
679 goto change_line; 707 goto change_line;
680 case '+': 708 case '+':
@@ -847,52 +875,52 @@ hunk_done: @@ -847,52 +875,52 @@ hunk_done:
847 LINENUM fillnew; /* index of new lines */ 875 LINENUM fillnew; /* index of new lines */
848 char ch; 876 char ch;
849 877
850 line_beginning = ftell(pfp); /* file pos of the current line */ 878 line_beginning = ftell(pfp); /* file pos of the current line */
851 ret = pgets(buf, buf_len, pfp); 879 ret = pgets(buf, buf_len, pfp);
852 p_input_line++; 880 p_input_line++;
853 if (ret == NULL || strnNE(buf, "@@ -", 4)) { 881 if (ret == NULL || strnNE(buf, "@@ -", 4)) {
854 next_intuit_at(line_beginning, p_input_line); 882 next_intuit_at(line_beginning, p_input_line);
855 return false; 883 return false;
856 } 884 }
857 s = buf + 4; 885 s = buf + 4;
858 if (!*s) 886 if (!*s)
859 malformed(); 887 malformed();
860 p_first = (LINENUM) atol(s); 888 p_first = getskiplinenum(&s);
861 while (isdigit((unsigned char)*s)) 
862 s++; 
863 if (*s == ',') { 889 if (*s == ',') {
864 p_ptrn_lines = (LINENUM) atol(++s); 890 s++;
865 while (isdigit((unsigned char)*s)) 891 p_ptrn_lines = getskiplinenum(&s);
866 s++; 
867 } else 892 } else
868 p_ptrn_lines = 1; 893 p_ptrn_lines = 1;
 894 if (p_first >= LINENUM_MAX - p_ptrn_lines)
 895 malformed();
869 if (*s == ' ') 896 if (*s == ' ')
870 s++; 897 s++;
871 if (*s != '+' || !*++s) 898 if (*s != '+' || !*++s)
872 malformed(); 899 malformed();
873 p_newfirst = (LINENUM) atol(s); 900 p_newfirst = getskiplinenum(&s);
874 while (isdigit((unsigned char)*s)) 
875 s++; 
876 if (*s == ',') { 901 if (*s == ',') {
877 p_repl_lines = (LINENUM) atol(++s); 902 s++;
878 while (isdigit((unsigned char)*s)) 903 p_repl_lines = getskiplinenum(&s);
879 s++; 
880 } else 904 } else
881 p_repl_lines = 1; 905 p_repl_lines = 1;
882 if (*s == ' ') 906 if (*s == ' ')
883 s++; 907 s++;
884 if (*s != '@') 908 if (*s != '@')
885 malformed(); 909 malformed();
 910 if (p_first >= LINENUM_MAX - p_ptrn_lines ||
 911 p_newfirst > LINENUM_MAX - p_repl_lines ||
 912 p_ptrn_lines >= LINENUM_MAX - p_repl_lines - 1)
 913 malformed();
886 if (!p_ptrn_lines) 914 if (!p_ptrn_lines)
887 p_first++; /* do append rather than insert */ 915 p_first++; /* do append rather than insert */
888 p_max = p_ptrn_lines + p_repl_lines + 1; 916 p_max = p_ptrn_lines + p_repl_lines + 1;
889 while (p_max >= hunkmax) 917 while (p_max >= hunkmax)
890 grow_hunkmax(); 918 grow_hunkmax();
891 fillold = 1; 919 fillold = 1;
892 fillnew = fillold + p_ptrn_lines; 920 fillnew = fillold + p_ptrn_lines;
893 p_end = fillnew + p_repl_lines; 921 p_end = fillnew + p_repl_lines;
894 snprintf(buf, buf_len, "*** %ld,%ld ****\n", p_first, 922 snprintf(buf, buf_len, "*** %ld,%ld ****\n", p_first,
895 p_first + p_ptrn_lines - 1); 923 p_first + p_ptrn_lines - 1);
896 p_line[0] = savestr(buf); 924 p_line[0] = savestr(buf);
897 if (out_of_mem) { 925 if (out_of_mem) {
898 p_end = -1; 926 p_end = -1;
@@ -1012,55 +1040,59 @@ hunk_done: @@ -1012,55 +1040,59 @@ hunk_done:
1012 } else { /* normal diff--fake it up */ 1040 } else { /* normal diff--fake it up */
1013 char hunk_type; 1041 char hunk_type;
1014 int i; 1042 int i;
1015 LINENUM min, max; 1043 LINENUM min, max;
1016 1044
1017 line_beginning = ftell(pfp); 1045 line_beginning = ftell(pfp);
1018 p_context = 0; 1046 p_context = 0;
1019 ret = pgets(buf, buf_len, pfp); 1047 ret = pgets(buf, buf_len, pfp);
1020 p_input_line++; 1048 p_input_line++;
1021 if (ret == NULL || !isdigit((unsigned char)*buf)) { 1049 if (ret == NULL || !isdigit((unsigned char)*buf)) {
1022 next_intuit_at(line_beginning, p_input_line); 1050 next_intuit_at(line_beginning, p_input_line);
1023 return false; 1051 return false;
1024 } 1052 }
1025 p_first = (LINENUM) atol(buf); 1053 s = buf;
1026 for (s = buf; isdigit((unsigned char)*s); s++) 1054 p_first = getskiplinenum(&s);
1027 ; 
1028 if (*s == ',') { 1055 if (*s == ',') {
1029 p_ptrn_lines = (LINENUM) atol(++s) - p_first + 1; 1056 s++;
1030 while (isdigit((unsigned char)*s)) 1057 p_ptrn_lines = getskiplinenum(&s) - p_first + 1;
1031 s++; 
1032 } else 1058 } else
1033 p_ptrn_lines = (*s != 'a'); 1059 p_ptrn_lines = (*s != 'a');
1034 hunk_type = *s; 1060 if (p_first >= LINENUM_MAX - p_ptrn_lines)
 1061 malformed();
 1062 hunk_type = *s++;
1035 if (hunk_type == 'a') 1063 if (hunk_type == 'a')
1036 p_first++; /* do append rather than insert */ 1064 p_first++; /* do append rather than insert */
1037 min = (LINENUM) atol(++s); 1065 min = getskiplinenum(&s);
1038 for (; isdigit((unsigned char)*s); s++) 
1039 ; 
1040 if (*s == ',') 1066 if (*s == ',')
1041 max = (LINENUM) atol(++s); 1067 max = getlinenum(++s);
1042 else 1068 else
1043 max = min; 1069 max = min;
 1070 if (min < 0 || min > max || max - min == LINENUM_MAX)
 1071 malformed();
1044 if (hunk_type == 'd') 1072 if (hunk_type == 'd')
1045 min++; 1073 min++;
1046 p_end = p_ptrn_lines + 1 + max - min + 1; 1074 p_end = p_ptrn_lines + 1 + max - min + 1;
 1075 p_newfirst = min;
 1076 p_repl_lines = max - min + 1;
 1077 if (p_newfirst > LINENUM_MAX - p_repl_lines ||
 1078 p_ptrn_lines >= LINENUM_MAX - p_repl_lines - 1)
 1079 malformed();
 1080 p_end = p_ptrn_lines + p_repl_lines + 1;
1047 if (p_end > MAXHUNKSIZE) 1081 if (p_end > MAXHUNKSIZE)
1048 fatal("hunk too large (%ld lines) at line %ld: %s", 1082 fatal("hunk too large (%ld lines) at line %ld: %s",
1049 p_end, p_input_line, buf); 1083 p_end, p_input_line, buf);
1050 while (p_end >= hunkmax) 1084 while (p_end >= hunkmax)
1051 grow_hunkmax(); 1085 grow_hunkmax();
1052 p_newfirst = min; 
1053 p_repl_lines = max - min + 1; 
1054 snprintf(buf, buf_len, "*** %ld,%ld\n", p_first, 1086 snprintf(buf, buf_len, "*** %ld,%ld\n", p_first,
1055 p_first + p_ptrn_lines - 1); 1087 p_first + p_ptrn_lines - 1);
1056 p_line[0] = savestr(buf); 1088 p_line[0] = savestr(buf);
1057 if (out_of_mem) { 1089 if (out_of_mem) {
1058 p_end = -1; 1090 p_end = -1;
1059 return false; 1091 return false;
1060 } 1092 }
1061 p_char[0] = '*'; 1093 p_char[0] = '*';
1062 for (i = 1; i <= p_ptrn_lines; i++) { 1094 for (i = 1; i <= p_ptrn_lines; i++) {
1063 ret = pgets(buf, buf_len, pfp); 1095 ret = pgets(buf, buf_len, pfp);
1064 p_input_line++; 1096 p_input_line++;
1065 if (ret == NULL) 1097 if (ret == NULL)
1066 fatal("unexpected end of file in patch at line %ld\n", 1098 fatal("unexpected end of file in patch at line %ld\n",