* [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
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.