aboutsummaryrefslogtreecommitdiff
path: root/gdbserver/tracepoint.cc
diff options
context:
space:
mode:
Diffstat (limited to 'gdbserver/tracepoint.cc')
-rw-r--r--gdbserver/tracepoint.cc9
1 files changed, 7 insertions, 2 deletions
diff --git a/gdbserver/tracepoint.cc b/gdbserver/tracepoint.cc
index f176ab2..a62d9a7 100644
--- a/gdbserver/tracepoint.cc
+++ b/gdbserver/tracepoint.cc
@@ -6895,8 +6895,13 @@ init_named_socket (const char *name)
addr.sun_family = AF_UNIX;
- strncpy (addr.sun_path, name, UNIX_PATH_MAX);
- addr.sun_path[UNIX_PATH_MAX - 1] = '\0';
+ if (strlen (name) >= ARRAY_SIZE (addr.sun_path))
+ {
+ warning ("socket name too long for sockaddr_un::sun_path field: %s", name);
+ return -1;
+ }
+
+ strcpy (addr.sun_path, name);
result = access (name, F_OK);
if (result == 0)