| diff --git a/acls.c b/acls.c |
| index 0f98df2..5f26d70 100644 |
| --- a/acls.c |
| +++ b/acls.c |
| @@ -178,7 +178,7 @@ struct acluser **up; |
| #endif |
| (*up)->u_Esc = DefaultEsc; |
| (*up)->u_MetaEsc = DefaultMetaEsc; |
| - strncpy((*up)->u_name, name, 20); |
| + strncpy((*up)->u_name, name, MAXSTR); |
| (*up)->u_password = NULL; |
| if (pass) |
| (*up)->u_password = SaveStr(pass); |
| @@ -314,8 +314,8 @@ struct acluser **up; |
| return UserAdd(name, pass, up); |
| if (!strcmp(name, "nobody")) /* he remains without password */ |
| return -1; |
| - strncpy((*up)->u_password, pass ? pass : "", 20); |
| - (*up)->u_password[20] = '\0'; |
| + strncpy((*up)->u_password, pass ? pass : "", MAXSTR); |
| + (*up)->u_password[MAXSTR] = '\0'; |
| return 0; |
| } |
| #endif |
| diff --git a/acls.h b/acls.h |
| index c41b714..7f20f55 100644 |
| --- a/acls.h |
| +++ b/acls.h |
| @@ -36,6 +36,16 @@ |
| #define ACLBYTE(data, w) ((data)[(w) >> 3]) |
| #define ACLBIT(w) (0x80 >> ((w) & 7)) |
| |
| +#include <limits.h> |
| + |
| +#ifndef NAME_MAX |
| +# ifndef MAXNAMELEN |
| +# define NAME_MAX 255 |
| +# else |
| +# define NAME_MAX MAXNAMELEN |
| +# endif |
| +#endif |
| + |
| typedef unsigned char * AclBits; |
| |
| /* |
| @@ -73,7 +83,7 @@ struct plop |
| typedef struct acluser |
| { |
| struct acluser *u_next; /* continue the main user list */ |
| - char u_name[20+1]; /* login name how he showed up */ |
| + char u_name[NAME_MAX+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 */ |
| diff --git a/display.h b/display.h |
| index ef99954..563fcd0 100644 |
| --- a/display.h |
| +++ b/display.h |
| @@ -22,6 +22,16 @@ |
| * $Id: 4.0.3-extend-d_termname-ng2.patch,v 1.2 2010/12/08 21:28:15 jlec Exp $ FAU |
| */ |
| |
| +#include <limits.h> |
| + |
| +#ifndef NAME_MAX |
| +# ifndef MAXNAMELEN |
| +# define NAME_MAX 255 |
| +# else |
| +# define NAME_MAX MAXNAMELEN |
| +# endif |
| +#endif |
| + |
| #ifdef MAPKEYS |
| |
| #define KMAP_KEYS (T_OCAPS-T_CAPS) |
| @@ -85,7 +95,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[20 + 1]; /* $TERM */ |
| + char d_termname[NAME_MAX + 1]; /* $TERM */ |
| char *d_tentry; /* buffer for tgetstr */ |
| char d_tcinited; /* termcap inited flag */ |
| int d_width, d_height; /* width/height of the screen */ |
| diff --git a/screen.c b/screen.c |
| index 70741df..6f45b60 100644 |
| --- a/screen.c |
| +++ b/screen.c |
| @@ -106,6 +106,16 @@ FILE *dfp; |
| #endif |
| |
| |
| +#include <limits.h> |
| + |
| +#ifndef NAME_MAX |
| +# ifndef MAXNAMELEN |
| +# define NAME_MAX 255 |
| +# else |
| +# define NAME_MAX MAXNAMELEN |
| +# endif |
| +#endif |
| + |
| extern char Term[], screenterm[], **environ, Termcap[]; |
| int force_vt = 1; |
| int VBellWait, MsgWait, MsgMinWait, SilenceWait; |
| @@ -877,13 +887,13 @@ char **av; |
| |
| if (home == 0 || *home == '\0') |
| home = ppp->pw_dir; |
| - if (strlen(LoginName) > 20) |
| + if (strlen(LoginName) > NAME_MAX) |
| Panic(0, "LoginName too long - sorry."); |
| #ifdef MULTIUSER |
| - if (multi && strlen(multi) > 20) |
| + if (multi && strlen(multi) > NAME_MAX) |
| Panic(0, "Screen owner name too long - sorry."); |
| #endif |
| - if (strlen(home) > MAXPATHLEN - 25) |
| + if (strlen(home) > MAXPATHLEN - NAME_MAX) |
| Panic(0, "$HOME too long - sorry."); |
| |
| attach_tty = ""; |
| diff --git a/screen.h b/screen.h |
| index 4f9f354..bcaaaf6 100644 |
| --- a/screen.h |
| +++ b/screen.h |
| @@ -43,6 +43,15 @@ |
| #include "comm.h" |
| #include "layer.h" |
| #include "term.h" |
| +#include <limits.h> |
| + |
| +#ifndef NAME_MAX |
| +# ifndef MAXNAMELEN |
| +# define NAME_MAX 255 |
| +# else |
| +# define NAME_MAX MAXNAMELEN |
| +# endif |
| +#endif |
| |
| |
| #ifdef DEBUG |
| @@ -195,26 +204,26 @@ struct msg |
| create; |
| struct |
| { |
| - char auser[20 + 1]; /* username */ |
| + char auser[NAME_MAX + 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[20 + 1]; /* terminal type */ |
| + char envterm[NAME_MAX + 1]; /* terminal type */ |
| int encoding; /* encoding of display */ |
| } |
| attach; |
| struct |
| { |
| - char duser[20 + 1]; /* username */ |
| + char duser[NAME_MAX + 1]; /* username */ |
| int dpid; /* pid of frontend */ |
| } |
| detach; |
| struct |
| { |
| - char auser[20 + 1]; /* username */ |
| + char auser[NAME_MAX + 1]; /* username */ |
| int nargs; |
| char cmd[MAXPATHLEN]; /* command */ |
| int apid; /* pid of frontend */ |
| diff --git a/socket.c b/socket.c |
| index 62a73af..1cc9c27 100644 |
| --- a/socket.c |
| +++ b/socket.c |
| @@ -45,6 +45,16 @@ |
| |
| #include "extern.h" |
| |
| +#include <limits.h> |
| + |
| +#ifndef NAME_MAX |
| +# ifndef MAXNAMELEN |
| +# define NAME_MAX 255 |
| +# else |
| +# define NAME_MAX MAXNAMELEN |
| +# endif |
| +#endif |
| + |
| static int CheckPid __P((int)); |
| static void ExecCreate __P((struct msg *)); |
| static void DoCommandMsg __P((struct msg *)); |
| @@ -1248,7 +1258,7 @@ static void PasswordProcessInput __P((char *, int)); |
| |
| struct pwdata { |
| int l; |
| - char buf[20 + 1]; |
| + char buf[NAME_MAX + 1]; |
| struct msg m; |
| }; |
| |