Commit 94b63b60 authored by Peter Maydell's avatar Peter Maydell
Browse files

Merge remote-tracking branch 'remotes/armbru/tags/pull-misc-2019-05-22' into staging



Miscellaneous patches for 2019-05-22

# gpg: Signature made Wed 22 May 2019 14:41:08 BST
# gpg:                using RSA key 3870B400EB918653
# gpg: Good signature from "Markus Armbruster <armbru@redhat.com>" [full]
# gpg:                 aka "Markus Armbruster <armbru@pond.sub.org>" [full]
# Primary key fingerprint: 354B C8B3 D7EB 2A6B 6867  4E5F 3870 B400 EB91 8653

* remotes/armbru/tags/pull-misc-2019-05-22:
  cutils: Simplify how parse_uint() checks for whitespace
  gdbstub: Fix misuse of isxdigit()
  gdbstub: Reject invalid RLE repeat counts
  tests/vhost-user-bridge: Fix misuse of isdigit()
  qemu-bridge-helper: Fix misuse of isspace()

Signed-off-by: default avatarPeter Maydell <peter.maydell@linaro.org>
parents 297a0827 db3d11ee
Loading
Loading
Loading
Loading
+12 −8
Original line number Diff line number Diff line
@@ -1987,7 +1987,7 @@ void gdb_do_syscall(gdb_syscall_complete_cb cb, const char *fmt, ...)
    va_end(va);
}

static void gdb_read_byte(GDBState *s, int ch)
static void gdb_read_byte(GDBState *s, uint8_t ch)
{
    uint8_t reply;

@@ -2001,7 +2001,7 @@ static void gdb_read_byte(GDBState *s, int ch)
        } else if (ch == '+') {
            trace_gdbstub_io_got_ack();
        } else {
            trace_gdbstub_io_got_unexpected((uint8_t)ch);
            trace_gdbstub_io_got_unexpected(ch);
        }

        if (ch == '+' || ch == '$')
@@ -2024,7 +2024,7 @@ static void gdb_read_byte(GDBState *s, int ch)
                s->line_sum = 0;
                s->state = RS_GETLINE;
            } else {
                trace_gdbstub_err_garbage((uint8_t)ch);
                trace_gdbstub_err_garbage(ch);
            }
            break;
        case RS_GETLINE:
@@ -2064,13 +2064,17 @@ static void gdb_read_byte(GDBState *s, int ch)
            }
            break;
        case RS_GETLINE_RLE:
            if (ch < ' ') {
            /*
             * Run-length encoding is explained in "Debugging with GDB /
             * Appendix E GDB Remote Serial Protocol / Overview".
             */
            if (ch < ' ' || ch == '#' || ch == '$' || ch > 126) {
                /* invalid RLE count encoding */
                trace_gdbstub_err_invalid_repeat((uint8_t)ch);
                trace_gdbstub_err_invalid_repeat(ch);
                s->state = RS_GETLINE;
            } else {
                /* decode repeat length */
                int repeat = (unsigned char)ch - ' ' + 3;
                int repeat = ch - ' ' + 3;
                if (s->line_buf_index + repeat >= sizeof(s->line_buf) - 1) {
                    /* that many repeats would overrun the command buffer */
                    trace_gdbstub_err_overrun();
@@ -2092,7 +2096,7 @@ static void gdb_read_byte(GDBState *s, int ch)
        case RS_CHKSUM1:
            /* get high hex digit of checksum */
            if (!isxdigit(ch)) {
                trace_gdbstub_err_checksum_invalid((uint8_t)ch);
                trace_gdbstub_err_checksum_invalid(ch);
                s->state = RS_GETLINE;
                break;
            }
@@ -2103,7 +2107,7 @@ static void gdb_read_byte(GDBState *s, int ch)
        case RS_CHKSUM2:
            /* get low hex digit of checksum */
            if (!isxdigit(ch)) {
                trace_gdbstub_err_checksum_invalid((uint8_t)ch);
                trace_gdbstub_err_checksum_invalid(ch);
                s->state = RS_GETLINE;
                break;
            }
+3 −3
Original line number Diff line number Diff line
@@ -75,7 +75,7 @@ static int parse_acl_file(const char *filename, ACLList *acl_list)
        char *ptr = line;
        char *cmd, *arg, *argend;

        while (isspace(*ptr)) {
        while (g_ascii_isspace(*ptr)) {
            ptr++;
        }

@@ -99,12 +99,12 @@ static int parse_acl_file(const char *filename, ACLList *acl_list)

        *arg = 0;
        arg++;
        while (isspace(*arg)) {
        while (g_ascii_isspace(*arg)) {
            arg++;
        }

        argend = arg + strlen(arg);
        while (arg != argend && isspace(*(argend - 1))) {
        while (arg != argend && g_ascii_isspace(*(argend - 1))) {
            argend--;
        }
        *argend = 0;
+2 −1
Original line number Diff line number Diff line
@@ -30,6 +30,7 @@
#define _FILE_OFFSET_BITS 64

#include "qemu/osdep.h"
#include "qemu-common.h"
#include "qemu/atomic.h"
#include "qemu/iov.h"
#include "standard-headers/linux/virtio_net.h"
@@ -645,7 +646,7 @@ vubr_host_notifier_setup(VubrDev *dev)
static void
vubr_set_host(struct sockaddr_in *saddr, const char *host)
{
    if (isdigit(host[0])) {
    if (qemu_isdigit(host[0])) {
        if (!inet_aton(host, &saddr->sin_addr)) {
            fprintf(stderr, "inet_aton() failed.\n");
            exit(1);
+1 −1
Original line number Diff line number Diff line
@@ -683,7 +683,7 @@ int parse_uint(const char *s, unsigned long long *value, char **endptr,
    }

    /* make sure we reject negative numbers: */
    while (isspace((unsigned char)*s)) {
    while (qemu_isspace(*s)) {
        s++;
    }
    if (*s == '-') {