[26887] in Athena Bugs

home help back first fref pref prev next nref lref last post

Re: linux 9.4.27: zaway

daemon@ATHENA.MIT.EDU (Rob Radez)
Wed Jul 12 13:05:27 2006

Date: Wed, 12 Jul 2006 13:05:19 -0400
From: Rob Radez <rradez@alum.mit.edu>
To: bugs@mit.edu
Message-ID: <20060712170519.GA4342@blueskies.mit.edu>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
X-Spam-Score: 0
X-Spam-Flag: NO
Errors-To: bugs-bounces@mit.edu

I'm not sure if it's even a bug or related to what Jon just reported,
but should the malloc on line 168 of zaway.c have a +1 since the strlen
does not include the terminating \0 in the length while strcpy does copy
the terminating \0?

Rob

--- zaway/zaway.c.orig	2006-07-12 12:56:49.943146613 -0400
+++ zaway/zaway.c	2006-07-12 12:56:56.695147513 -0400
@@ -165,7 +165,7 @@
 		}
 
 		if (cmdline_msg) {
-			ptr = malloc(strlen(cmdline_msg));
+			ptr = malloc(strlen(cmdline_msg)+1);
 			if (!ptr) {
 				com_err(argv[0],ENOMEM,"while getting cmdline message");
 				exit(1);

home help back first fref pref prev next nref lref last post