All of lore.kernel.org
 help / color / mirror / Atom feed
* [uml-devel] Off by one error in umid.c
@ 2004-07-16  1:51 Jim Pick
  2004-07-28  4:35 ` Jeff Dike
  0 siblings, 1 reply; 2+ messages in thread
From: Jim Pick @ 2004-07-16  1:51 UTC (permalink / raw)
  To: user-mode-linux-devel

[-- Attachment #1: Type: text/plain, Size: 743 bytes --]

Here's a fix for a little memory corruption I was having.  I was passing 
in a uml_dir directory without a trailing slash.

Cheers,

  - Jim

Index: linux-2.4.22-uml1/arch/um/kernel/umid.c
===================================================================
--- linux-2.4.22-uml1.orig/arch/um/kernel/umid.c	2004-07-15 
16:34:57.000000000 -0700
+++ linux-2.4.22-uml1/arch/um/kernel/umid.c	2004-07-15 
18:15:54.699873738 -0700
@@ -200,7 +200,7 @@
  static int __init set_uml_dir(char *name, int *add)
  {
  	if((strlen(name) > 0) && (name[strlen(name) - 1] != '/')){
-		uml_dir = malloc(strlen(name) + 1);
+		uml_dir = malloc(strlen(name) + 2);
  		if(uml_dir == NULL){
  			printf("Failed to malloc uml_dir - error = %d\n",
  			       errno);


[-- Attachment #2: umid_dir_off-by-one.patch --]
[-- Type: text/plain, Size: 592 bytes --]

Index: linux-2.4.22-uml1/arch/um/kernel/umid.c
===================================================================
--- linux-2.4.22-uml1.orig/arch/um/kernel/umid.c	2004-07-15 16:34:57.000000000 -0700
+++ linux-2.4.22-uml1/arch/um/kernel/umid.c	2004-07-15 18:15:54.699873738 -0700
@@ -200,7 +200,7 @@
 static int __init set_uml_dir(char *name, int *add)
 {
 	if((strlen(name) > 0) && (name[strlen(name) - 1] != '/')){
-		uml_dir = malloc(strlen(name) + 1);
+		uml_dir = malloc(strlen(name) + 2);
 		if(uml_dir == NULL){
 			printf("Failed to malloc uml_dir - error = %d\n",
 			       errno);

^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: [uml-devel] Off by one error in umid.c
  2004-07-16  1:51 [uml-devel] Off by one error in umid.c Jim Pick
@ 2004-07-28  4:35 ` Jeff Dike
  0 siblings, 0 replies; 2+ messages in thread
From: Jeff Dike @ 2004-07-28  4:35 UTC (permalink / raw)
  To: Jim Pick; +Cc: user-mode-linux-devel

jim@jimpick.com said:
> Here's a fix for a little memory corruption I was having.  I was
> passing  in a uml_dir directory without a trailing slash. 

Nice spotting.

		Jeff



-------------------------------------------------------
This SF.Net email is sponsored by BEA Weblogic Workshop
FREE Java Enterprise J2EE developer tools!
Get your free copy of BEA WebLogic Workshop 8.1 today.
http://ads.osdn.com/?ad_id=4721&alloc_id=10040&op=click
_______________________________________________
User-mode-linux-devel mailing list
User-mode-linux-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-devel

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2004-07-28  3:37 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-07-16  1:51 [uml-devel] Off by one error in umid.c Jim Pick
2004-07-28  4:35 ` Jeff Dike

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.