[pkg-opensc-commit] [engine-pkcs11] 74/152: always allocate full size, as we will clean full size later. strncpy will maybe not \0 terminate the string, but that is ok, we deal with it already.

Eric Dorland eric at moszumanska.debian.org
Mon Oct 19 03:11:17 UTC 2015


This is an automated email from the git hooks/post-receive script.

eric pushed a commit to branch master
in repository engine-pkcs11.

commit da935bf128be99df115454e4cfe61163c0b79c21
Author: Andreas Jellinghaus <andreas at ionisiert.de>
Date:   Thu Aug 28 20:37:22 2008 +0000

    always allocate full size, as we will clean full size later.
    strncpy will maybe not \0 terminate the string, but that is ok,
    we deal with it already.
---
 src/engine_pkcs11.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/src/engine_pkcs11.c b/src/engine_pkcs11.c
index 44da40e..7fdacc6 100644
--- a/src/engine_pkcs11.c
+++ b/src/engine_pkcs11.c
@@ -90,7 +90,8 @@ int set_pin(const char *_pin)
 
 	/* Copy the PIN. If the string cannot be copied, NULL
 	   shall be returned and errno shall be set. */
-	pin = strdup(_pin);
+	pin = malloc(MAX_PIN_LENGTH);
+	strncpy(pin,_pin,MAX_PIN_LENGTH);
 
 	return (pin != NULL);
 }

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/pkg-opensc/engine-pkcs11.git



More information about the pkg-opensc-commit mailing list