Page Menu
Home
FreeBSD
Search
Configure Global Search
Log In
Files
F107031089
D36822.id.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Flag For Later
Award Token
Size
1 KB
Referenced Files
None
Subscribers
None
D36822.id.diff
View Options
diff --git a/usr.bin/diff/diffreg.c b/usr.bin/diff/diffreg.c
--- a/usr.bin/diff/diffreg.c
+++ b/usr.bin/diff/diffreg.c
@@ -980,7 +980,6 @@
int ret;
ret = regexec(&ignore_re, line, 0, NULL, 0);
- free(line);
return (ret == 0); /* if it matched, it should be ignored. */
}
@@ -988,13 +987,10 @@
ignoreline(char *line, bool skip_blanks)
{
- if (ignore_pats != NULL && skip_blanks)
- return (ignoreline_pattern(line) || *line == '\0');
- if (ignore_pats != NULL)
- return (ignoreline_pattern(line));
- if (skip_blanks)
- return (*line == '\0');
- /* No ignore criteria specified */
+ if (skip_blanks && *line == '\0')
+ return (true);
+ if (ignore_pats != NULL && ignoreline_pattern(line))
+ return (true);
return (false);
}
@@ -1013,7 +1009,7 @@
long curpos;
int i, nc;
const char *walk;
- bool skip_blanks;
+ bool skip_blanks, ignore;
skip_blanks = (*pflags & D_SKIPBLANKLINES);
restart:
@@ -1030,7 +1026,9 @@
for (i = a; i <= b; i++) {
line = preadline(fileno(f1),
ixold[i] - ixold[i - 1], ixold[i - 1]);
- if (!ignoreline(line, skip_blanks))
+ ignore = ignoreline(line, skip_blanks);
+ free(line);
+ if (!ignore)
goto proceed;
}
}
@@ -1038,7 +1036,9 @@
for (i = c; i <= d; i++) {
line = preadline(fileno(f2),
ixnew[i] - ixnew[i - 1], ixnew[i - 1]);
- if (!ignoreline(line, skip_blanks))
+ ignore = ignoreline(line, skip_blanks);
+ free(line);
+ if (!ignore)
goto proceed;
}
}
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Jan 10, 5:54 AM (1 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
15739682
Default Alt Text
D36822.id.diff (1 KB)
Attached To
Mode
D36822: diff: Fix a use after free as well as a memory leak in change().
Attached
Detach File
Event Timeline
Log In to Comment