[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[PATCH] spell.c: uninitialized value in mindist
From: |
Grisha Levit |
Subject: |
[PATCH] spell.c: uninitialized value in mindist |
Date: |
Mon, 20 May 2024 22:21:40 -0400 |
./bash --norc -in <<<$'XX\cXs'
bash-5.3$ XX==34016==WARNING: MemorySanitizer: use-of-uninitialized-value
#0 0xaaaaaafbbb80 in mindist /home/vm/src/bash/local/lib/sh/spell.c:138:22
#1 0xaaaaaafbb468 in spname /home/vm/src/bash/local/lib/sh/spell.c:90:11
#2 0xaaaaaafbbe78 in dirspell /home/vm/src/bash/local/lib/sh/spell.c:195:11
---
lib/sh/spell.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/lib/sh/spell.c b/lib/sh/spell.c
index eb215b84..1bd1197c 100644
--- a/lib/sh/spell.c
+++ b/lib/sh/spell.c
@@ -135,7 +135,7 @@ mindist(const char *dir, char *guess, char *best)
(void)closedir(fd);
/* Don't return `.' */
- if (best[0] == '.' && best[1] == '\0')
+ if (dist != 3 && best[0] == '.' && best[1] == '\0')
dist = 3;
return dist;
}
--
2.45.1
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [PATCH] spell.c: uninitialized value in mindist,
Grisha Levit <=