aboutsummaryrefslogtreecommitdiff
path: root/usr.bin/patch
diff options
context:
space:
mode:
authorPedro F. Giffuni <pfg@FreeBSD.org>2021-07-22 19:09:17 +0000
committerPedro F. Giffuni <pfg@FreeBSD.org>2021-07-22 19:23:22 +0000
commitc384a27805a630ae45ca3d97614a07ebfce5515d (patch)
tree38877a757ff091ad1efd02671fa253fdb03cedbc /usr.bin/patch
parent4a235049082ee1cb044873ad9aff12cf73d0fd3b (diff)
Diffstat (limited to 'usr.bin/patch')
-rw-r--r--usr.bin/patch/inp.c4
-rw-r--r--usr.bin/patch/pch.c2
2 files changed, 4 insertions, 2 deletions
diff --git a/usr.bin/patch/inp.c b/usr.bin/patch/inp.c
index 6a01f782ce62..99be70957f06 100644
--- a/usr.bin/patch/inp.c
+++ b/usr.bin/patch/inp.c
@@ -284,7 +284,7 @@ static void
plan_b(const char *filename)
{
FILE *ifp;
- size_t i = 0, j, len, maxlen = 1;
+ size_t i, j, len, maxlen;
char *lbuf = NULL, *p;
bool found_revision = (revision == NULL);
@@ -294,6 +294,8 @@ plan_b(const char *filename)
unlink(TMPINNAME);
if ((tifd = open(TMPINNAME, O_EXCL | O_CREAT | O_WRONLY, 0666)) < 0)
pfatal("can't open file %s", TMPINNAME);
+ len = 0;
+ maxlen = 1;
while ((p = fgetln(ifp, &len)) != NULL) {
if (p[len - 1] == '\n')
p[len - 1] = '\0';
diff --git a/usr.bin/patch/pch.c b/usr.bin/patch/pch.c
index 70051640cf0c..d1d71f95644c 100644
--- a/usr.bin/patch/pch.c
+++ b/usr.bin/patch/pch.c
@@ -1215,7 +1215,7 @@ size_t
pgets(bool do_indent)
{
char *line;
- size_t len;
+ size_t len = 0;
int indent = 0, skipped = 0;
line = fgetln(pfp, &len);