Zsh Mailing List Archive
Messages sorted by:
Reverse Date,
Date,
Thread,
Author
PATCH: Coverity CID 1692314 avoid overflowing version field in dump header
- X-seq: zsh-workers 54539
- From: Mikael Magnusson <mikachu@xxxxxxxxx>
- To: zsh-workers@xxxxxxx
- Subject: PATCH: Coverity CID 1692314 avoid overflowing version field in dump header
- Date: Thu, 14 May 2026 17:19:56 +0200
- Archived-at: <https://zsh.org/workers/54539>
- In-reply-to: <20260514152003.27178-1-mikachu@gmail.com>
- List-id: <zsh-workers.zsh.org>
- References: <20260514152003.27178-1-mikachu@gmail.com>
This would only happen if you at compile time make the version string 40
characters or longer, which would be quite silly.
---
Src/parse.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/Src/parse.c b/Src/parse.c
index 2b7f8bb595..21b95bcb7d 100644
--- a/Src/parse.c
+++ b/Src/parse.c
@@ -3350,7 +3350,7 @@ write_dump(int dfd, LinkList progs, int map, int hlen, int tlen)
fdmagic(pre) = (other ? FD_OMAGIC : FD_MAGIC);
fdsetflags(pre, ((map ? FDF_MAP : 0) | other));
fdsetother(pre, tlen);
- strcpy(fdversion(pre), ZSH_VERSION);
+ strncpy(fdversion(pre), ZSH_VERSION, sizeof(wordcode) * (FD_PRELEN - 2) - 1);
write_loop(dfd, (char *)pre, FD_PRELEN * sizeof(wordcode));
for (node = firstnode(progs); node; incnode(node)) {
--
2.38.1
Messages sorted by:
Reverse Date,
Date,
Thread,
Author