* [Qemu-devel] [PULL 0/1] inet_listen_opts: add error checking
@ 2014-06-13 11:32 Gerd Hoffmann
2014-06-13 11:32 ` [Qemu-devel] [PULL 1/1] " Gerd Hoffmann
2014-06-13 17:17 ` [Qemu-devel] [PULL 0/1] " Peter Maydell
0 siblings, 2 replies; 3+ messages in thread
From: Gerd Hoffmann @ 2014-06-13 11:32 UTC (permalink / raw)
To: qemu-devel; +Cc: Gerd Hoffmann
Hi,
Fix for the qemu-sockets parser.
please pull,
Gerd
The following changes since commit 2a2c4830c0068d70443f3dddc4cc668f0c601b5c:
Merge remote-tracking branch 'remotes/kraxel/tags/pull-gtk-20140611-1' into staging (2014-06-12 09:51:41 +0100)
are available in the git repository at:
git://git.kraxel.org/qemu tags/pull-trivial-20140613-1
for you to fetch changes up to 8bc891279604186562f59a4239e42dcb451c60d3:
inet_listen_opts: add error checking (2014-06-13 12:34:57 +0200)
----------------------------------------------------------------
inet_listen_opts: add error checking
----------------------------------------------------------------
Gerd Hoffmann (1):
inet_listen_opts: add error checking
util/qemu-sockets.c | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
^ permalink raw reply [flat|nested] 3+ messages in thread
* [Qemu-devel] [PULL 1/1] inet_listen_opts: add error checking
2014-06-13 11:32 [Qemu-devel] [PULL 0/1] inet_listen_opts: add error checking Gerd Hoffmann
@ 2014-06-13 11:32 ` Gerd Hoffmann
2014-06-13 17:17 ` [Qemu-devel] [PULL 0/1] " Peter Maydell
1 sibling, 0 replies; 3+ messages in thread
From: Gerd Hoffmann @ 2014-06-13 11:32 UTC (permalink / raw)
To: qemu-devel; +Cc: Gerd Hoffmann
Don't use atoi() function which doesn't detect errors, switch to
strtol and error out on failures. Also add a range check while
being at it.
Signed-off-by: Gerd Hoffmann <kraxel@redhat.com>
Reviewed-by: Markus Armbruster <armbru@redhat.com>
---
util/qemu-sockets.c | 15 +++++++++++++--
1 file changed, 13 insertions(+), 2 deletions(-)
diff --git a/util/qemu-sockets.c b/util/qemu-sockets.c
index e3d29ee..a4a1e9d 100644
--- a/util/qemu-sockets.c
+++ b/util/qemu-sockets.c
@@ -131,8 +131,19 @@ int inet_listen_opts(QemuOpts *opts, int port_offset, Error **errp)
ai.ai_family = PF_INET6;
/* lookup */
- if (port_offset)
- snprintf(port, sizeof(port), "%d", atoi(port) + port_offset);
+ if (port_offset) {
+ unsigned long long baseport;
+ if (parse_uint_full(port, &baseport, 10) < 0) {
+ error_setg(errp, "can't convert to a number: %s", port);
+ return -1;
+ }
+ if (baseport > 65535 ||
+ baseport + port_offset > 65535) {
+ error_setg(errp, "port %s out of range", port);
+ return -1;
+ }
+ snprintf(port, sizeof(port), "%d", (int)baseport + port_offset);
+ }
rc = getaddrinfo(strlen(addr) ? addr : NULL, port, &ai, &res);
if (rc != 0) {
error_setg(errp, "address resolution failed for %s:%s: %s", addr, port,
--
1.8.3.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [Qemu-devel] [PULL 0/1] inet_listen_opts: add error checking
2014-06-13 11:32 [Qemu-devel] [PULL 0/1] inet_listen_opts: add error checking Gerd Hoffmann
2014-06-13 11:32 ` [Qemu-devel] [PULL 1/1] " Gerd Hoffmann
@ 2014-06-13 17:17 ` Peter Maydell
1 sibling, 0 replies; 3+ messages in thread
From: Peter Maydell @ 2014-06-13 17:17 UTC (permalink / raw)
To: Gerd Hoffmann; +Cc: QEMU Developers
On 13 June 2014 12:32, Gerd Hoffmann <kraxel@redhat.com> wrote:
> Hi,
>
> Fix for the qemu-sockets parser.
>
> please pull,
> Gerd
>
> The following changes since commit 2a2c4830c0068d70443f3dddc4cc668f0c601b5c:
>
> Merge remote-tracking branch 'remotes/kraxel/tags/pull-gtk-20140611-1' into staging (2014-06-12 09:51:41 +0100)
>
> are available in the git repository at:
>
>
> git://git.kraxel.org/qemu tags/pull-trivial-20140613-1
>
> for you to fetch changes up to 8bc891279604186562f59a4239e42dcb451c60d3:
>
> inet_listen_opts: add error checking (2014-06-13 12:34:57 +0200)
>
> ----------------------------------------------------------------
> inet_listen_opts: add error checking
>
> ----------------------------------------------------------------
> Gerd Hoffmann (1):
> inet_listen_opts: add error checking
>
> util/qemu-sockets.c | 15 +++++++++++++--
> 1 file changed, 13 insertions(+), 2 deletions(-)
>
Applied, thanks.
-- PMM
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2014-06-13 17:18 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2014-06-13 11:32 [Qemu-devel] [PULL 0/1] inet_listen_opts: add error checking Gerd Hoffmann
2014-06-13 11:32 ` [Qemu-devel] [PULL 1/1] " Gerd Hoffmann
2014-06-13 17:17 ` [Qemu-devel] [PULL 0/1] " Peter Maydell
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.