Miscellaneous patches for 2019-05-22

-----BEGIN PGP SIGNATURE-----
 
 iQIcBAABAgAGBQJc5VF0AAoJEDhwtADrkYZTF0UP/j7Mtv7/AYrike4GXMgU/8fO
 f5BzjBjJnHKFuTJH2jp9NFju1N8j79tCfuh0Ir4ZfmMbQM+dSZC4Xtd9tgGoLNs1
 iDKddlN4zUzCYYIyan2cBe69kdAox9sWjE/Y51RqoBXeA8mVFM6NOkW9qyKeXudC
 MymxafaUs3Z0a1DdTLKxlNDzsfrJPKS2BVq9CdT3+ujlFJCiaJDVtAAmccKCIplA
 TqaYceUsfxogzZRwTPzC5xzv5FQga97y+Yid4tycB2cUMjJsipCGfNu6nxFjS30W
 5fGmczz1ih3fxAH1UCZX3nL4Q2GDQMaYl9cbXUM8Q9XH2fsY0Xja9edyKK86w5N0
 5lM8Bo4dbxausAbVx1EP/Lpe+avekoWlnWOBhSrDsW3P7vJDqT+98t722e6l5Q2M
 Pzs2JLK8qNvnwDfSZdYCySYGepNMTxAJsEqTd0Bl4a8b2e0Er3mia94Ph6RRpwqZ
 buh78QUJeYmvXNROeE0EEkQP8txMTyMhcIvdll106JLJJ9CuswiVFUELCjdv5oh6
 NcMEnVM8vavkuhHWiaMv3m/QbVkMuLUt2LolpiMk56MKBcz7uR7ep8SdvNyBuffl
 /7UVY8d60pxeY+BJxBlqN/mg7YC/Grt6XpGjcqK64t9x43HMaKn5EVDZ4hV9GNX2
 9rvTtLXm/LLfIuD/y9HO
 =opvX
 -----END PGP SIGNATURE-----

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: Peter Maydell <peter.maydell@linaro.org>
This commit is contained in:
Peter Maydell 2019-05-23 11:22:01 +01:00
commit 94b63b6007
4 changed files with 18 additions and 13 deletions

View File

@ -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;
}

View File

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

View File

@ -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);

View File

@ -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 == '-') {