(main): Null-terminate system_name.
authorRichard M. Stallman <rms@gnu.org>
Sat, 10 Oct 1998 21:20:22 +0000 (21:20 +0000)
committerRichard M. Stallman <rms@gnu.org>
Sat, 10 Oct 1998 21:20:22 +0000 (21:20 +0000)
lib-src/emacsclient.c
lib-src/emacsserver.c

index 07d446b..5e95604 100644 (file)
@@ -225,6 +225,8 @@ main (argc, argv)
     struct stat statbfr;
 
     gethostname (system_name, sizeof (system_name));
+    /* system_name must be null-terminated string */
+    system_name[sizeof (system_name) - 1] = '\0';
     sprintf (server.sun_path, "/tmp/esrv%d-%s", geteuid (), system_name);
 
     if (stat (server.sun_path, &statbfr) == -1)
index 3675c8e..ba3fa08 100644 (file)
@@ -251,6 +251,8 @@ main (argc, argv)
   server.sun_family = AF_UNIX;
 #ifndef SERVER_HOME_DIR
   gethostname (system_name, sizeof (system_name));
+    /* system_name must be null-terminated string */
+    system_name[sizeof (system_name) - 1] = '\0';
   sprintf (server.sun_path, "/tmp/esrv%d-%s", geteuid (), system_name);
 
   if (unlink (server.sun_path) == -1 && errno != ENOENT)