]> CyberLeo.Net >> Repos - FreeBSD/stable/10.git/commit
MFC 299458: Fix buffer overrun in gcore(1) NT_PRPSINFO
authorjhb <jhb@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Thu, 6 Oct 2016 19:41:09 +0000 (19:41 +0000)
committerjhb <jhb@ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f>
Thu, 6 Oct 2016 19:41:09 +0000 (19:41 +0000)
commitf8901a145c066bccf5585f6f1c006b2cc8e91b72
tree3f0670c20ae21b3e6b95a1bed9f7f1728843e96c
parent12452c1873d1b59916a17de263561a5c9a2bb68d
MFC 299458: Fix buffer overrun in gcore(1) NT_PRPSINFO

Use size of destination buffer, rather than a constant that may or may not
correspond to the source buffer, to restrict the length of copied strings.  In
particular, pr_fname has 16+1 characters but MAXCOMLEN is 18+1.

Use strlcpy instead of strncpy to ensure the result is nul-terminated.  This
seems to be what is expected of these fields.

git-svn-id: svn://svn.freebsd.org/base/stable/10@306781 ccf9f872-aa2e-dd11-9fc8-001c23d0bc1f
usr.bin/gcore/elfcore.c