qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Jim Hawkins <qemu@jawkins.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] Bug in linux-user/syscall.c utime
Date: Mon, 3 May 2004 03:58:16 +0100 (BST)	[thread overview]
Message-ID: <Pine.LNX.4.58.0405030336590.14361@britney.jawkins.net> (raw)

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

                 reply	other threads:[~2004-05-03  2:58 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

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=Pine.LNX.4.58.0405030336590.14361@britney.jawkins.net \
    --to=qemu@jawkins.com \
    --cc=qemu-devel@nongnu.org \
    /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 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).