File 0001-Placate-a-gcc7-warning.patch of Package reptyr
From ff28aca0ff53e9c5c8d0e627ee134dc86d813807 Mon Sep 17 00:00:00 2001
From: Nelson Elhage <nelhage@nelhage.com>
Date: Sat, 18 Feb 2017 16:36:40 -0800
Subject: [PATCH 1/2] Placate a gcc7 warning.
(And handle a too-long temp directory with an error instead of a likely
crash)
---
attach.c | 7 +++++--
1 file changed, 5 insertions(+), 2 deletions(-)
diff --git a/attach.c b/attach.c
index 4e65d25..dff4040 100644
--- a/attach.c
+++ b/attach.c
@@ -375,8 +375,11 @@ int setup_steal_socket(struct steal_pty_state *steal) {
return errno;
steal->addr_un.sun_family = AF_UNIX;
- snprintf(steal->addr_un.sun_path, sizeof(steal->addr_un.sun_path),
- "%s/reptyr.sock", steal->tmpdir);
+ if (snprintf(steal->addr_un.sun_path, sizeof(steal->addr_un.sun_path),
+ "%s/reptyr.sock", steal->tmpdir) >= sizeof(steal->addr_un.sun_path)) {
+ error("tmpdir path too long!");
+ return ENAMETOOLONG;
+ }
if ((steal->sockfd = socket(AF_UNIX, SOCK_DGRAM, 0)) < 0)
return errno;
--
2.11.0