aboutsummaryrefslogtreecommitdiffstats
path: root/lib-src
diff options
context:
space:
mode:
authorRichard M. Stallman1998-10-10 21:20:22 +0000
committerRichard M. Stallman1998-10-10 21:20:22 +0000
commit5fb29af43c1c5e7941645b97542a90ae5df18ebf (patch)
treee8bb9f81a7a14c26c865b69ede72ae036a4f47fe /lib-src
parent0ec56a80564f2053e28e0da56e60ea50f50e5241 (diff)
downloademacs-5fb29af43c1c5e7941645b97542a90ae5df18ebf.tar.gz
emacs-5fb29af43c1c5e7941645b97542a90ae5df18ebf.zip
(main): Null-terminate system_name.
Diffstat (limited to 'lib-src')
-rw-r--r--lib-src/emacsclient.c2
-rw-r--r--lib-src/emacsserver.c2
2 files changed, 4 insertions, 0 deletions
diff --git a/lib-src/emacsclient.c b/lib-src/emacsclient.c
index 07d446b7aa4..5e95604c4f9 100644
--- a/lib-src/emacsclient.c
+++ b/lib-src/emacsclient.c
@@ -225,6 +225,8 @@ main (argc, argv)
225 struct stat statbfr; 225 struct stat statbfr;
226 226
227 gethostname (system_name, sizeof (system_name)); 227 gethostname (system_name, sizeof (system_name));
228 /* system_name must be null-terminated string */
229 system_name[sizeof (system_name) - 1] = '\0';
228 sprintf (server.sun_path, "/tmp/esrv%d-%s", geteuid (), system_name); 230 sprintf (server.sun_path, "/tmp/esrv%d-%s", geteuid (), system_name);
229 231
230 if (stat (server.sun_path, &statbfr) == -1) 232 if (stat (server.sun_path, &statbfr) == -1)
diff --git a/lib-src/emacsserver.c b/lib-src/emacsserver.c
index 3675c8efcaf..ba3fa08476e 100644
--- a/lib-src/emacsserver.c
+++ b/lib-src/emacsserver.c
@@ -251,6 +251,8 @@ main (argc, argv)
251 server.sun_family = AF_UNIX; 251 server.sun_family = AF_UNIX;
252#ifndef SERVER_HOME_DIR 252#ifndef SERVER_HOME_DIR
253 gethostname (system_name, sizeof (system_name)); 253 gethostname (system_name, sizeof (system_name));
254 /* system_name must be null-terminated string */
255 system_name[sizeof (system_name) - 1] = '\0';
254 sprintf (server.sun_path, "/tmp/esrv%d-%s", geteuid (), system_name); 256 sprintf (server.sun_path, "/tmp/esrv%d-%s", geteuid (), system_name);
255 257
256 if (unlink (server.sun_path) == -1 && errno != ENOENT) 258 if (unlink (server.sun_path) == -1 && errno != ENOENT)