1
0
mirror of https://git.FreeBSD.org/src.git synced 2025-01-29 16:44:03 +00:00

Use explicit sizes for the prpsinfo command length string so that

we dont have any more unexpected changes in core dumps.  This gets us
back to the original core dump layout from a few days ago.
This commit is contained in:
Peter Wemm 2001-08-16 08:35:51 +00:00
parent 8ab59f7093
commit 6eef6816a8
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=81757
2 changed files with 4 additions and 2 deletions

View File

@ -919,7 +919,8 @@ elf_corehdr(p, vp, cred, numsegs, hdr, hdrsize)
bzero(&psinfo, sizeof psinfo);
psinfo.pr_version = PRPSINFO_VERSION;
psinfo.pr_psinfosz = sizeof(prpsinfo_t);
strncpy(psinfo.pr_fname, p->p_comm, MAXCOMLEN);
strncpy(psinfo.pr_fname, p->p_comm, sizeof(psinfo.pr_fname) - 1);
psinfo.pr_fname[sizeof(psinfo.pr_fname) - 1] = '\0';
/* XXX - We don't fill in the command line arguments properly yet. */
strncpy(psinfo.pr_psargs, p->p_comm, PRARGSZ);

View File

@ -67,6 +67,7 @@ typedef struct prstatus {
typedef fpregset_t prfpregset_t;
#define PRFNAMESZ 16 /* Maximum command length saved */
#define PRARGSZ 80 /* Maximum argument bytes saved */
#define PRPSINFO_VERSION 1 /* Current version of prpsinfo_t */
@ -74,7 +75,7 @@ typedef fpregset_t prfpregset_t;
typedef struct prpsinfo {
int pr_version; /* Version number of struct (1) */
size_t pr_psinfosz; /* sizeof(prpsinfo_t) (1) */
char pr_fname[MAXCOMLEN+1]; /* Command name, null terminated (1) */
char pr_fname[PRFNAMESZ+1]; /* Command name, null terminated (1) */
char pr_psargs[PRARGSZ+1]; /* Arguments, null terminated (1) */
} prpsinfo_t;