← Commit list

20c22e088

Mike Frysinger
Mike Frysinger
2006-04-16
SOURCE BUG Duration: 26s

Subject

just use the stack to kill memleak and return if user didnt give us anything to match

SOURCE BUG

This commit was genuinely broken at the time (not related to our build system): scripts/config/mkconfigs.c (2005-08-01 - 2006-10-05 arasi) uretilen bbconfigopts.h icine .config satirlarini kacissiz, ham newline'larla gömüyordu - gecerli C degildi, busybox'un kendi bb_mkdep araci bile parse edemiyordu (7d219aab7 ile duzeltildi, mkconfigs shell scripte cevrildi)

→ Bu hatanin tam hikayesini ve duzeltme diffini gor

Binary

No binary (build failed)

Architecture & Compiler Flags

Architecture: x86_64-linux-gnu Compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3) 11.4.0

—

Build Log

(log yok)

Commit Diff GitHub →

miscutils/less.c+5 -7
@@ -659,7 +659,7 @@ static void regex_process(void)
char current_line[256];
int i;
int j = 0;
- regex_t *pattern;
+ regex_t pattern;
/* Reset variables */
match_lines[0] = -1;
@@ -667,9 +667,6 @@ static void regex_process(void)
num_matches = 0;
match_found = 0;
- pattern = (regex_t *) malloc(sizeof(regex_t));
- memset(pattern, 0, sizeof(regex_t));
-
/* Get the uncompiled regular expression from the user */
clear_line();
putchar((match_backwards) ? '?' : '/');
@@ -681,14 +678,15 @@ static void regex_process(void)
uncomp_regex[i-1] = '\0';
else
while((i = getchar()) != '\n' && i != EOF);
- }
+ } else
+ return;
/* Compile the regex and check for errors */
- xregcomp(pattern, uncomp_regex, 0);
+ xregcomp(&pattern, uncomp_regex, 0);
/* Run the regex on each line of the current file here */
for (i = 0; i <= num_flines; i++) {
- strcpy(current_line, process_regex_on_line(flines[i], pattern));
+ strcpy(current_line, process_regex_on_line(flines[i], &pattern));
flines[i] = bb_xstrdup(current_line);
if (match_found) {
match_lines[j] = i;