Fix a potential buffer overflow condition.

Submitted by:	Somebody on -hackers, ooops, i've already deleted that mail
This commit is contained in:
Joerg Wunsch 1996-08-08 07:58:07 +00:00
parent d670a62ab5
commit fef1477642
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=17472

View File

@ -29,7 +29,7 @@
* OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
* SUCH DAMAGE.
*
* $Id: modstat.c,v 1.2 1995/04/18 02:19:17 wpaul Exp $
* $Id: modstat.c,v 1.3 1995/04/20 05:08:53 wpaul Exp $
*/
#include <stdio.h>
@ -72,8 +72,9 @@ dostat(devfd, modnum, modname)
{
struct lmc_stat sbuf;
sbuf.name[MAXLKMNAME - 1] = '\0'; /* In case strncpy limits the string. */
if (modname != NULL)
strcpy(sbuf.name, modname);
strncpy(sbuf.name, modname, MAXLKMNAME - 1);
sbuf.id = modnum;