* [Qemu-devel] Bug in linux-user/syscall.c utime
@ 2004-05-03 2:58 Jim Hawkins
0 siblings, 0 replies; only message in thread
From: Jim Hawkins @ 2004-05-03 2:58 UTC (permalink / raw)
To: qemu-devel
[-- Attachment #1: Type: TEXT/PLAIN, Size: 161 bytes --]
Hi,
The utime handler in linux-user/syscall.c doesn't test for arg2 being
NULL, which can cause a segfault (eg "touch foo"). The attached patch
fixes this.
Jim
[-- Attachment #2: Type: TEXT/PLAIN, Size: 639 bytes --]
--- linux-user/syscall.c.old Mon May 3 03:42:59 2004
+++ linux-user/syscall.c Mon May 3 03:30:19 2004
@@ -1728,12 +1734,14 @@
ret = get_errno(pause());
break;
case TARGET_NR_utime:
- {
+ if (arg2) {
struct utimbuf tbuf;
struct target_utimbuf *target_tbuf = (void *)arg2;
tbuf.actime = tswapl(target_tbuf->actime);
tbuf.modtime = tswapl(target_tbuf->modtime);
ret = get_errno(utime((const char *)arg1, &tbuf));
+ } else {
+ ret = get_errno(utime((const char *)arg1, NULL));
}
break;
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2004-05-03 2:58 UTC | newest]
Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2004-05-03 2:58 [Qemu-devel] Bug in linux-user/syscall.c utime Jim Hawkins
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).