* [uml-devel] [PATCH 1/9] UML - Fix /proc/mounts parsing boundary condition
@ 2006-06-29 21:36 Jeff Dike
0 siblings, 0 replies; only message in thread
From: Jeff Dike @ 2006-06-29 21:36 UTC (permalink / raw)
To: akpm; +Cc: linux-kernel, user-mode-linux-devel
When parsing /proc/mounts looking for a tmpfs mount on /dev/shm, if
a string that we are looking for if split across reads, then it
won't be recognized.
Fix this by refilling the buffer whenever we advance the cursor.
Signed-off-by: Jeff Dike <jdike@addtoit.com>
Index: linux-2.6.16-rc-mm/arch/um/os-Linux/mem.c
===================================================================
--- linux-2.6.16-rc-mm.orig/arch/um/os-Linux/mem.c 2006-06-11 14:27:36.000000000 -0400
+++ linux-2.6.16-rc-mm/arch/um/os-Linux/mem.c 2006-06-28 13:07:35.000000000 -0400
@@ -55,7 +55,7 @@ static void __init find_tempdir(void)
*/
static int next(int fd, char *buf, int size, char c)
{
- int n;
+ int n, len;
char *ptr;
while((ptr = strchr(buf, c)) == NULL){
@@ -69,7 +69,17 @@ static int next(int fd, char *buf, int s
}
ptr++;
- memmove(buf, ptr, strlen(ptr) + 1);
+ len = strlen(ptr);
+ memmove(buf, ptr, len + 1);
+
+ /* Refill the buffer so that if there's a partial string that we care
+ * about, it will be completed, and we can recognize it.
+ */
+ n = read(fd, &buf[len], size - len - 1);
+ if(n < 0)
+ return -errno;
+
+ buf[len + n] = '\0';
return 1;
}
Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo
http://sel.as-us.falkag.net/sel?cmd=lnk&kid=120709&bid=263057&dat=121642
_______________________________________________
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] only message in thread
only message in thread, other threads:[~2006-06-29 21:36 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2006-06-29 21:36 [uml-devel] [PATCH 1/9] UML - Fix /proc/mounts parsing boundary condition Jeff Dike
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox