diff options
author | Peter Maydell <peter.maydell@linaro.org> | 2019-05-23 11:22:01 +0100 |
---|---|---|
committer | Peter Maydell <peter.maydell@linaro.org> | 2019-05-23 11:22:01 +0100 |
commit | 94b63b6007cb03dc77ab0833259c1e0d5e6b6fc1 (patch) | |
tree | f1d09f68395c80e7977ce2ed72e8fc4301349f74 /gdbstub.c | |
parent | 297a082700d2985ba862fd13a27fb539a8f26e2a (diff) | |
parent | db3d11ee3f0cb851124830172f0a93c3d77a450a (diff) | |
download | qemu-94b63b6007cb03dc77ab0833259c1e0d5e6b6fc1.zip qemu-94b63b6007cb03dc77ab0833259c1e0d5e6b6fc1.tar.gz qemu-94b63b6007cb03dc77ab0833259c1e0d5e6b6fc1.tar.bz2 |
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>
Diffstat (limited to 'gdbstub.c')
-rw-r--r-- | gdbstub.c | 20 |
1 files changed, 12 insertions, 8 deletions
@@ -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; } |