[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
sharutils 4.5: Fix memory corruption with "shar ."
From: |
Andreas Schwab |
Subject: |
sharutils 4.5: Fix memory corruption with "shar ." |
Date: |
Wed, 10 Aug 2005 17:08:43 +0200 |
User-agent: |
Gnus/5.110003 (No Gnus v0.3) Emacs/22.0.50 (gnu/linux) |
Don't write beyond the bounds of the allocated memory.
Andreas.
2005-08-10 Andreas Schwab <address@hidden>
* shar.c (walkdown): Don't let restore_name_length become
negative.
--- src/shar.c
+++ src/shar.c
@@ -382,14 +382,9 @@
/* Avoid restoring `./xxx' when shar'ing `.'. */
if (!strncmp (restore_name_copy, "./", 2))
- {
- const char *rp = restore_name_copy + 2;
- char *wp = restore_name_copy;
- while ((*wp++ = *rp++));
- restore_name_length -= 2;
- }
-
- status = walkdown (routine, local_name_copy, restore_name_copy);
+ status = walkdown (routine, local_name_copy, restore_name_copy + 2);
+ else
+ status = walkdown (routine, local_name_copy, restore_name_copy);
}
/* Clean up. */
--
Andreas Schwab, SuSE Labs, address@hidden
SuSE Linux Products GmbH, Maxfeldstraße 5, 90409 Nürnberg, Germany
Key fingerprint = 58CA 54C7 6D53 942B 1756 01D3 44D5 214B 8276 4ED5
"And now for something completely different."
- sharutils 4.5: Fix memory corruption with "shar .",
Andreas Schwab <=