diff --git a/vendor.sh b/vendor.sh index 21cd2af..5c99138 100755 --- a/vendor.sh +++ b/vendor.sh @@ -1,7 +1,7 @@ #!/bin/bash set -eux -o pipefail -# Aug 26, 2019 -LIBSLIRP_COMMIT=d203c81bc6c861e1671122c3194c21d1a6763641 +# Nov 21, 2019 +LIBSLIRP_COMMIT=d171af3732a0610a25334b06b77fa547bd677918 LIBSLIRP_REPO=https://gitlab.freedesktop.org/slirp/libslirp.git # Jul 12, 2019 diff --git a/vendor/README.md b/vendor/README.md index 8036fe2..2ac63d6 100644 --- a/vendor/README.md +++ b/vendor/README.md @@ -1,7 +1,7 @@ # DO NOT EDIT MANUALLY Vendored components: -* libslirp: https://gitlab.freedesktop.org/slirp/libslirp.git (`d203c81bc6c861e1671122c3194c21d1a6763641`) +* libslirp: https://gitlab.freedesktop.org/slirp/libslirp.git (`d171af3732a0610a25334b06b77fa547bd677918`) * parson: https://github.com/kgabis/parson.git (`c5bb9557fe98367aa8e041c65863909f12ee76b2`) Please do not edit the contents under this directory manually. diff --git a/vendor/libslirp/src/misc.c b/vendor/libslirp/src/misc.c index 6675acc..560d5f1 100644 --- a/vendor/libslirp/src/misc.c +++ b/vendor/libslirp/src/misc.c @@ -168,7 +168,8 @@ g_spawn_async_with_fds_slirp(const gchar *working_directory, gchar **argv, int fork_exec(struct socket *so, const char *ex) { GError *err = NULL; - char **argv; + gint argc = 0; + gchar **argv = NULL; int opt, sp[2]; DEBUG_CALL("fork_exec"); @@ -179,7 +180,12 @@ int fork_exec(struct socket *so, const char *ex) return 0; } - argv = g_strsplit(ex, " ", -1); + if (!g_shell_parse_argv(ex, &argc, &argv, &err)) { + g_critical("fork_exec invalid command: %s\nerror: %s", ex, err->message); + g_error_free(err); + return 0; + } + g_spawn_async_with_fds(NULL /* cwd */, argv, NULL /* env */, G_SPAWN_SEARCH_PATH, fork_exec_child_setup, NULL /* data */, NULL /* child_pid */, sp[1], sp[1], diff --git a/vendor/libslirp/src/sbuf.c b/vendor/libslirp/src/sbuf.c index abced48..0569c34 100644 --- a/vendor/libslirp/src/sbuf.c +++ b/vendor/libslirp/src/sbuf.c @@ -39,13 +39,16 @@ void sbreserve(struct sbuf *sb, int size) if (sb->sb_data) { /* Already alloced, realloc if necessary */ if (sb->sb_datalen != size) { - sb->sb_wptr = sb->sb_rptr = sb->sb_data = - (char *)realloc(sb->sb_data, size); + char *new = realloc(sb->sb_data, size); sb->sb_cc = 0; - if (sb->sb_wptr) + if (new) { + sb->sb_data = sb->sb_wptr = sb->sb_rptr = new; sb->sb_datalen = size; - else + } else { + free(sb->sb_data); + sb->sb_data = sb->sb_wptr = sb->sb_rptr = NULL; sb->sb_datalen = 0; + } } } else { sb->sb_wptr = sb->sb_rptr = sb->sb_data = (char *)malloc(size); diff --git a/vendor/libslirp/src/socket.c b/vendor/libslirp/src/socket.c index d96d8c4..2f20028 100644 --- a/vendor/libslirp/src/socket.c +++ b/vendor/libslirp/src/socket.c @@ -195,7 +195,9 @@ int soread(struct socket *so) err = errno; if (nn == 0) { - if (getpeername(so->s, paddr, &alen) < 0) { + int shutdown_wr = so->so_state & SS_FCANTSENDMORE; + + if (!shutdown_wr && getpeername(so->s, paddr, &alen) < 0) { err = errno; } else { getsockopt(so->s, SOL_SOCKET, SO_ERROR, &err, &elen);