=================================================================== RCS file: /cvsrepo/anoncvs/cvs/src/usr.bin/patch/patch.c,v retrieving revision 1.68 retrieving revision 1.69 diff -c -r1.68 -r1.69 *** src/usr.bin/patch/patch.c 2019/06/28 13:35:02 1.68 --- src/usr.bin/patch/patch.c 2019/12/02 22:17:32 1.69 *************** *** 1,4 **** ! /* $OpenBSD: patch.c,v 1.68 2019/06/28 13:35:02 deraadt Exp $ */ /* * patch - a program to apply diffs to original files --- 1,4 ---- ! /* $OpenBSD: patch.c,v 1.69 2019/12/02 22:17:32 jca Exp $ */ /* * patch - a program to apply diffs to original files *************** *** 47,53 **** mode_t filemode = 0644; ! char buf[MAXLINELEN]; /* general purpose buffer */ bool using_plan_a = true; /* try to keep everything in memory */ bool out_of_mem = false; /* ran out of memory in plan a */ --- 47,54 ---- mode_t filemode = 0644; ! char *buf; /* general purpose buffer */ ! size_t bufsz; /* general purpose buffer size */ bool using_plan_a = true; /* try to keep everything in memory */ bool out_of_mem = false; /* ran out of memory in plan a */ *************** *** 152,157 **** --- 153,163 ---- perror("pledge"); my_exit(2); } + + bufsz = INITLINELEN; + if ((buf = malloc(bufsz)) == NULL) + pfatal("allocating input buffer"); + buf[0] = '\0'; setvbuf(stdout, NULL, _IOLBF, 0); setvbuf(stderr, NULL, _IOLBF, 0);