summaryrefslogtreecommitdiff
path: root/gdb/remote.c
diff options
context:
space:
mode:
authorAndrew Cagney <cagney@redhat.com>2001-11-15 02:56:29 +0000
committerAndrew Cagney <cagney@redhat.com>2001-11-15 02:56:29 +0000
commit8ee677fccd07bceade937ed2d4a14409d00e97c7 (patch)
treed43580bcb8cdb487282cbaa3969ed8a246dfeb68 /gdb/remote.c
parentd81839465a61cfb845a235214abb976aeb690a47 (diff)
downloadgdb-8ee677fccd07bceade937ed2d4a14409d00e97c7.tar.gz
* remote.c: Include "gdb_assert.h".
(tty_input): Wire buffer to 400 bytes. (readsocket): Check tty_input doesn't overflow. (build_remote_gdbarch_data, _initialize_remote): Don't multi-arch tty_input.
Diffstat (limited to 'gdb/remote.c')
-rw-r--r--gdb/remote.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/gdb/remote.c b/gdb/remote.c
index e7b7169a2ac..b588f3332b4 100644
--- a/gdb/remote.c
+++ b/gdb/remote.c
@@ -37,6 +37,7 @@
#include "remote.h"
#include "regcache.h"
#include "value.h"
+#include "gdb_assert.h"
#include <ctype.h>
#include <sys/time.h>
@@ -5404,8 +5405,9 @@ enum
}
minitelnet_return;
-/* shared between readsocket() and readtty() */
-static char *tty_input;
+/* Shared between readsocket() and readtty(). The size is arbitrary,
+ however all targets are known to support a 400 character packet. */
+static char tty_input[400];
static int escape_count;
static int echo_check;
@@ -5451,6 +5453,7 @@ readsocket (void)
{
if (tty_input[echo_check] == data)
{
+ gdb_assert (echo_check <= sizeof (tty_input));
echo_check++; /* Character matched user input: */
continue; /* Continue without echoing it. */
}
@@ -5787,9 +5790,6 @@ static void
build_remote_gdbarch_data (void)
{
build_remote_packet_sizes ();
-
- /* Cisco stuff */
- tty_input = xmalloc (PBUFSIZ);
remote_address_size = TARGET_ADDR_BIT;
}
@@ -5819,7 +5819,6 @@ _initialize_remote (void)
/* architecture specific data */
build_remote_gdbarch_data ();
- register_gdbarch_swap (&tty_input, sizeof (&tty_input), NULL);
register_remote_packet_sizes ();
register_gdbarch_swap (&remote_address_size,
sizeof (&remote_address_size), NULL);