mirror of
https://github.com/freebsd/freebsd-src.git
synced 2024-11-27 17:52:43 +00:00
MFC r277802, r277811:
sed: Fix resource leak and dereference after NULL. process.c: Protect access against NULL. main.c: Prevent outfile overwrite resource leak. CID: 271181 CID: 1006930 Obtained from: NetBSD
This commit is contained in:
parent
6e47d49fbf
commit
d38e133476
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/stable/10/; revision=277933
@ -409,6 +409,8 @@ mf_fgets(SPACE *sp, enum e_spflag spflag)
|
||||
if (len >= sizeof(tmpfname))
|
||||
errx(1, "%s: name too long", fname);
|
||||
unlink(tmpfname);
|
||||
if (outfile != NULL && outfile != stdout)
|
||||
fclose(outfile);
|
||||
if ((outfile = fopen(tmpfname, "w")) == NULL)
|
||||
err(1, "%s", fname);
|
||||
fchown(fileno(outfile), sb.st_uid, sb.st_gid);
|
||||
|
@ -314,7 +314,7 @@ applies(struct s_command *cp)
|
||||
} else
|
||||
r = 1;
|
||||
}
|
||||
} else if (MATCH(cp->a1)) {
|
||||
} else if (cp->a1 && MATCH(cp->a1)) {
|
||||
/*
|
||||
* If the second address is a number less than or
|
||||
* equal to the line number first selected, only
|
||||
|
Loading…
Reference in New Issue
Block a user