All of lore.kernel.org
 help / color / mirror / Atom feed
From: Jim Pick <jim@jimpick.com>
To: user-mode-linux-devel@lists.sourceforge.net
Subject: [uml-devel] Off by one error in umid.c
Date: Thu, 15 Jul 2004 18:51:26 -0700	[thread overview]
Message-ID: <40F7349E.7010109@jimpick.com> (raw)

[-- 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);

             reply	other threads:[~2004-07-16  1:53 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-07-16  1:51 Jim Pick [this message]
2004-07-28  4:35 ` [uml-devel] Off by one error in umid.c Jeff Dike

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=40F7349E.7010109@jimpick.com \
    --to=jim@jimpick.com \
    --cc=user-mode-linux-devel@lists.sourceforge.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.