From: Pablo Virolainen <Pablo.Virolainen@nomovok.com>
To: qemu-devel@nongnu.org
Subject: [Qemu-devel] Fix for accept
Date: Thu, 13 Jul 2006 13:21:50 +0300 [thread overview]
Message-ID: <44B61EBE.1090907@nomovok.com> (raw)
[-- Attachment #1: Type: text/plain, Size: 174 bytes --]
Following code crashes qemu user emulation.
#include <sys/types.h>
#include <sys/socket.h>
int main() {
accept(0,NULL,NULL);
return 0;
}
Pablo Virolainen
[-- Attachment #2: accept.patch --]
[-- Type: text/x-patch, Size: 1086 bytes --]
Index: linux-user/syscall.c
===================================================================
RCS file: /sources/qemu/qemu/linux-user/syscall.c,v
retrieving revision 1.75
diff -u -r1.75 syscall.c
--- linux-user/syscall.c 27 Jun 2006 21:08:10 -0000 1.75
+++ linux-user/syscall.c 13 Jul 2006 10:18:57 -0000
@@ -878,9 +878,20 @@
int sockfd = tgetl(vptr);
target_ulong target_addr = tgetl(vptr + n);
target_ulong target_addrlen = tgetl(vptr + 2 * n);
- socklen_t addrlen = tget32(target_addrlen);
- void *addr = alloca(addrlen);
-
+ socklen_t addrlen=0;
+ /* Just to get rid of compiler warnings */
+ ulong addrt=0;
+ void *addr;
+
+ get_user(addrlen,&target_addrlen);
+ get_user(addrt,&target_addr);
+
+ if (addrt!=0) {
+ addr = alloca(addrlen);
+ } else {
+ addr = NULL;
+ }
+
ret = get_errno(accept(sockfd, addr, &addrlen));
if (!is_error(ret)) {
host_to_target_sockaddr(target_addr, addr, addrlen);
next reply other threads:[~2006-07-13 10:21 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-07-13 10:21 Pablo Virolainen [this message]
2006-07-13 20:40 ` [Qemu-devel] Fix for accept Fabrice Bellard
2006-07-14 7:48 ` Pablo Virolainen
2006-07-14 9:53 ` Fabrice Bellard
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=44B61EBE.1090907@nomovok.com \
--to=pablo.virolainen@nomovok.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 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.