LogoopenSUSE Build Service > Projects
Sign Up | Log In

View File shellinabox.patch of Package shellinabox (Project openSUSE:Factory)

--- shellinabox/launcher.c.orig	2011-05-02 22:37:22.000000000 +0200
+++ shellinabox/launcher.c	2011-05-02 22:25:58.000000000 +0200
@@ -425,7 +425,7 @@
   request->width       = session->width;
   request->height      = session->height;
   strncat(request->peerName, httpGetPeerName(session->http),
-          sizeof(request->peerName) - 1);
+          sizeof(request->peerName) - strlen(request->peerName) - 1);
   request->urlLength   = strlen(u);
   memcpy(&request->url, u, request->urlLength);
   free(u);
@@ -476,10 +476,10 @@
 #ifdef HAVE_UTMPX_H
   utmp->utmpx.ut_type       = useLogin ? LOGIN_PROCESS : USER_PROCESS;
   dcheck(!strncmp(ptyPath, "/dev/pts", 8));
-  strncat(&utmp->utmpx.ut_line[0], ptyPath + 5,   sizeof(utmp->utmpx.ut_line));
-  strncat(&utmp->utmpx.ut_id[0],   ptyPath + 8,   sizeof(utmp->utmpx.ut_id));
-  strncat(&utmp->utmpx.ut_user[0], "SHELLINABOX", sizeof(utmp->utmpx.ut_user));
-  strncat(&utmp->utmpx.ut_host[0], peerName,      sizeof(utmp->utmpx.ut_host));
+  strncat(&utmp->utmpx.ut_line[0], ptyPath + 5,   sizeof(utmp->utmpx.ut_line) - strlen(utmp->utmpx.ut_line) - 1 );
+  strncat(&utmp->utmpx.ut_id[0],   ptyPath + 8,   sizeof(utmp->utmpx.ut_id)  - strlen(utmp->utmpx.ut_line) - 1 );
+  strncat(&utmp->utmpx.ut_user[0], "SHELLINABOX", sizeof(utmp->utmpx.ut_user)  - strlen(utmp->utmpx.ut_line) - 1 );
+  strncat(&utmp->utmpx.ut_host[0], peerName,      sizeof(utmp->utmpx.ut_host)  - strlen(utmp->utmpx.ut_line) - 1);
   struct timeval tv;
   check(!gettimeofday(&tv, NULL));
   utmp->utmpx.ut_tv.tv_sec  = tv.tv_sec;
@@ -1023,7 +1023,7 @@
   if (service->authUser != 2 /* SSH */) {
     memset(&utmp->utmpx.ut_user, 0, sizeof(utmp->utmpx.ut_user));
     strncat(&utmp->utmpx.ut_user[0], service->user,
-            sizeof(utmp->utmpx.ut_user));
+            sizeof(utmp->utmpx.ut_user) - strlen(utmp->utmpx.ut_user) - 1 );
     setutxent();
     pututxline(&utmp->utmpx);
     endutxent();
@@ -1310,7 +1310,7 @@
   endutxent();
   if (!utmp->useLogin) {
     memset(&utmpx.ut_user, 0, sizeof(utmpx.ut_user));
-    strncat(&utmpx.ut_user[0], "LOGIN", sizeof(utmpx.ut_user));
+    strncat(&utmpx.ut_user[0], "LOGIN", sizeof(utmpx.ut_user) - strlen(utmpx.ut_user) - 1);
     updwtmpx("/var/log/wtmp", &utmpx);
   }
 #endif