[Midnightbsd-cvs] src [10665] trunk/lib/libmp/mpasbn.c: fix length

laffer1 at midnightbsd.org laffer1 at midnightbsd.org
Sat Jun 9 15:32:08 EDT 2018


Revision: 10665
          http://svnweb.midnightbsd.org/src/?rev=10665
Author:   laffer1
Date:     2018-06-09 15:32:08 -0400 (Sat, 09 Jun 2018)
Log Message:
-----------
fix length

Modified Paths:
--------------
    trunk/lib/libmp/mpasbn.c

Modified: trunk/lib/libmp/mpasbn.c
===================================================================
--- trunk/lib/libmp/mpasbn.c	2018-06-09 19:31:21 UTC (rev 10664)
+++ trunk/lib/libmp/mpasbn.c	2018-06-09 19:32:08 UTC (rev 10665)
@@ -1,3 +1,4 @@
+/* $MidnightBSD$ */
 /*
  * Copyright (c) 2001 Dima Dorfman.
  * All rights reserved.
@@ -70,7 +71,7 @@
  */
 
 #include <sys/cdefs.h>
-__MBSDID("$MidnightBSD$");
+__FBSDID("$FreeBSD: stable/10/lib/libmp/mpasbn.c 301806 2016-06-10 18:10:32Z ngie $");
 
 #include <ctype.h>
 #include <err.h>
@@ -286,10 +287,10 @@
 	line = fgetln(stdin, &linelen);
 	if (line == NULL)
 		MPERR(("min"));
-	nline = malloc(linelen);
+	nline = malloc(linelen + 1);
 	if (nline == NULL)
 		MPERR(("min"));
-	strncpy(nline, line, linelen);
+	memcpy(nline, line, linelen);
 	nline[linelen] = '\0';
 	rmp = _dtom("min", nline);
 	_movem("min", rmp, mp);



More information about the Midnightbsd-cvs mailing list