mirror of
https://anongit.gentoo.org/git/repo/gentoo.git
synced 2025-06-13 16:42:39 +02:00
29 lines
870 B
Diff
29 lines
870 B
Diff
https://git.savannah.gnu.org/cgit/diffutils.git/commit/?id=e9f8e6a439fd607adbdd846ab93267dc367b5c79
|
|
|
|
From e9f8e6a439fd607adbdd846ab93267dc367b5c79 Mon Sep 17 00:00:00 2001
|
|
From: Paul Eggert <eggert@cs.ucla.edu>
|
|
Date: Fri, 28 Feb 2025 22:53:28 -0800
|
|
Subject: diff: fix allocation typo leading to crashes
|
|
|
|
But reported by Nick Smallbone, with one-line fix by
|
|
Collin Funk <https://bugs.gnu.org/76613>.
|
|
* src/io.c (find_and_hash_each_line): Fix size computation.
|
|
---
|
|
src/io.c | 2 +-
|
|
2 files changed, 4 insertions(+), 1 deletion(-)
|
|
|
|
--- a/src/io.c
|
|
+++ b/src/io.c
|
|
@@ -1012,7 +1012,7 @@ find_and_hash_each_line (struct file_data *current)
|
|
linbuf += linbuf_base;
|
|
linbuf = xpalloc (linbuf, &n, 1, -1, sizeof *linbuf);
|
|
linbuf -= linbuf_base;
|
|
- alloc_lines = n - linbuf_base;
|
|
+ alloc_lines = linbuf_base + n;
|
|
}
|
|
linbuf[line] = p;
|
|
|
|
--
|
|
cgit v1.1
|
|
|
|
|