diff options
-rw-r--r-- | src/acls.c | 2 | ||||
-rw-r--r-- | src/acls.h | 2 | ||||
-rw-r--r-- | src/comm.c | 1 | ||||
-rw-r--r-- | src/display.h | 2 | ||||
-rw-r--r-- | src/os.h | 6 | ||||
-rw-r--r-- | src/process.c | 4 | ||||
-rw-r--r-- | src/screen.c | 4 | ||||
-rw-r--r-- | src/screen.h | 10 | ||||
-rw-r--r-- | src/socket.c | 2 |
9 files changed, 20 insertions, 13 deletions
@@ -182,7 +182,7 @@ struct acluser **up; #endif (*up)->u_Esc = DefaultEsc; (*up)->u_MetaEsc = DefaultMetaEsc; - strncpy((*up)->u_name, name, 32); + strncpy((*up)->u_name, name, MAXLOGINLEN); (*up)->u_password = NULL; if (pass) (*up)->u_password = SaveStr(pass); @@ -78,7 +78,7 @@ struct plop typedef struct acluser { struct acluser *u_next; /* continue the main user list */ - char u_name[32 + 1]; /* login name how he showed up */ + char u_name[MAXLOGINLEN + 1]; /* login name how he showed up */ char *u_password; /* his password (may be NullStr). */ int u_checkpassword; /* nonzero if this u_password is valid */ int u_detachwin; /* the window where he last detached */ @@ -36,6 +36,7 @@ */ #include "config.h" +#include "os.h" #include "acls.h" #include "comm.h" diff --git a/src/display.h b/src/display.h index 5a497c5..a433e6d 100644 --- a/src/display.h +++ b/src/display.h @@ -73,7 +73,7 @@ struct display struct win *d_other; /* pointer to other window */ int d_nonblock; /* -1 don't block if obufmax reached */ /* >0: block after nonblock secs */ - char d_termname[32 + 1]; /* $TERM */ + char d_termname[MAXTERMLEN + 1]; /* $TERM */ char *d_tentry; /* buffer for tgetstr */ char d_tcinited; /* termcap inited flag */ int d_width, d_height; /* width/height of the screen */ @@ -521,3 +521,9 @@ typedef struct fd_set { int fds_bits[1]; } fd_set; */ #define IOSIZE 4096 +/* Changing those you won't be able to attach to your old sessions + * when changing those values in official tree don't forget to bump + * MSG_VERSION */ +#define MAXTERMLEN 32 +#define MAXLOGINLEN 256 + diff --git a/src/process.c b/src/process.c index d9dfc17..0fadf8f 100644 --- a/src/process.c +++ b/src/process.c @@ -2664,9 +2664,9 @@ int key; s = NULL; if (ParseSaveStr(act, &s)) break; - if (strlen(s) >= 20) + if (strlen(s) >= MAXTERMLEN) { - OutputMsg(0, "%s: term: argument too long ( < 20)", rc_name); + OutputMsg(0, "%s: term: argument too long ( < %d)", rc_name, MAXTERMLEN); free(s); break; } diff --git a/src/screen.c b/src/screen.c index fd6eb2f..aacacf6 100644 --- a/src/screen.c +++ b/src/screen.c @@ -978,10 +978,10 @@ char **av; if (home == 0 || *home == '\0') home = ppp->pw_dir; - if (strlen(LoginName) > 32) + if (strlen(LoginName) > MAXLOGINLEN) Panic(0, "LoginName too long - sorry."); #ifdef MULTIUSER - if (multi && strlen(multi) > 20) + if (multi && strlen(multi) > MAXLOGINLEN) Panic(0, "Screen owner name too long - sorry."); #endif if (strlen(home) > MAXPATHLEN - 25) diff --git a/src/screen.h b/src/screen.h index 36fb8d7..d02feac 100644 --- a/src/screen.h +++ b/src/screen.h @@ -203,32 +203,32 @@ struct msg int nargs; char line[MAXPATHLEN]; char dir[MAXPATHLEN]; - char screenterm[32]; /* is screen really "screen" ? */ + char screenterm[MAXTERMLEN]; /* is screen really "screen" ? */ } create; struct { - char auser[32 + 1]; /* username */ + char auser[MAXLOGINLEN + 1]; /* username */ int apid; /* pid of frontend */ int adaptflag; /* adapt window size? */ int lines, columns; /* display size */ char preselect[20]; int esc; /* his new escape character unless -1 */ int meta_esc; /* his new meta esc character unless -1 */ - char envterm[32 + 1]; /* terminal type */ + char envterm[MAXTERMLEN + 1]; /* terminal type */ int encoding; /* encoding of display */ int detachfirst; /* whether to detach remote sessions first */ } attach; struct { - char duser[32 + 1]; /* username */ + char duser[MAXLOGINLEN + 1]; /* username */ int dpid; /* pid of frontend */ } detach; struct { - char auser[32 + 1]; /* username */ + char auser[MAXLOGINLEN + 1]; /* username */ int nargs; char cmd[MAXPATHLEN]; /* command */ int apid; /* pid of frontend */ diff --git a/src/socket.c b/src/socket.c index 5d40f9c..711c709 100644 --- a/src/socket.c +++ b/src/socket.c @@ -1528,7 +1528,7 @@ static void PasswordProcessInput __P((char *, int)); struct pwdata { int l; - char buf[32 + 1]; + char buf[MAXLOGINLEN + 1]; struct msg m; }; |