about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2021-04-19 10:36:43 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2021-04-19 10:36:43 +0000
commitc776811af67d99cdd22593c0eac8ff54876235b5 (patch)
tree131fa34114e1246218c6e5ebde7d3787b9fb9b13 /src
parent793cf14db75f7802408130ef87598850f3186956 (diff)
downloadutmps-c776811af67d99cdd22593c0eac8ff54876235b5.tar.gz
utmps-c776811af67d99cdd22593c0eac8ff54876235b5.tar.xz
utmps-c776811af67d99cdd22593c0eac8ff54876235b5.zip
I *did* say it was a bad idea to remove sanitization, Xavier.
Diffstat (limited to 'src')
-rw-r--r--src/utmps/utmps-wtmpd.c13
1 files changed, 7 insertions, 6 deletions
diff --git a/src/utmps/utmps-wtmpd.c b/src/utmps/utmps-wtmpd.c
index 6a543af..b8639f8 100644
--- a/src/utmps/utmps-wtmpd.c
+++ b/src/utmps/utmps-wtmpd.c
@@ -50,6 +50,7 @@ int main (void)
   w = buffer_timed_get_g(buffer_0small, buf, sizeof(struct utmpx), &deadline) ; 
   if (w < sizeof(struct utmpx)) strerr_diefu1sys(111, "read from stdin") ;
   utmps_utmpx_unpack(buf, &b) ;
+  b.ut_user[UTMPS_UT_NAMESIZE - 1] = 0 ;
   if (uid)
   {
     struct passwd *pw ;
@@ -65,13 +66,13 @@ int main (void)
       else
       {
         answer(EPERM) ;
-        strerr_diefu2x(1, "verify ut_user identity", ": no such user") ;
+        strerr_diefu2x(1, "verify ut_user identity: ", "no such user") ;
       }
     }
     if (pw->pw_uid != uid)
     {
       answer(EPERM) ;
-      strerr_diefu2x(1, "verify ut_user identity", ": uid mismatch") ;
+      strerr_diefu2x(1, "verify ut_user identity: ", "uid mismatch") ;
     }
   }
   
@@ -79,17 +80,17 @@ int main (void)
   if (fd < 0)
   {
     answer(errno) ;
-    strerr_diefu1sys(111, "open wtmp") ;
+    strerr_diefu2sys(111, "open", " wtmp") ;
   }
   if (fd_lock(fd, 1, 0) < 1)
   {
     answer(errno) ;
-    strerr_diefu1sys(111, "open wtmp") ;
+    strerr_diefu2sys(111, "lock", " wtmp") ;
   }
   if (lseek(fd, 0, SEEK_END) < 0)
   {
     answer(errno) ;
-    strerr_diefu1sys(111, "lseek on wtmp") ;
+    strerr_diefu2sys(111, "lseek on", " wtmp") ;
   }
   w = allwrite(fd, buf, sizeof(struct utmpx)) ;
   if (w < sizeof(struct utmpx))
@@ -103,7 +104,7 @@ int main (void)
     fd_unlock(fd) ;
     answer(e) ;
     errno = e ;
-    strerr_diefu1sys(111, "append to wtmp") ;
+    strerr_diefu2sys(111, "append to", " wtmp") ;
   }
   fsync(fd) ;
   fd_unlock(fd) ;