summaryrefslogtreecommitdiff
path: root/ckcapi.c
diff options
context:
space:
mode:
Diffstat (limited to 'ckcapi.c')
-rw-r--r--ckcapi.c17
1 files changed, 13 insertions, 4 deletions
diff --git a/ckcapi.c b/ckcapi.c
index 1a398b3..d56d910 100644
--- a/ckcapi.c
+++ b/ckcapi.c
@@ -23,6 +23,9 @@
#include "ckcapi.h"
+/* Warns about all the raw string usage in this file */
+#pragma warning (disable : 4996)
+
/* -------------------------------------------------------------------
* GLOBALS / DEFINES
*/
@@ -47,18 +50,24 @@ static HANDLE global_mutex = NULL;
* MODULE GLOBAL FUNCTIONS
*/
+#define LINE 1024
+
void
ckcapi_debug(const char* msg, ...)
{
- char buf[1024];
+ char buf[LINE];
va_list va;
+ size_t len;
va_start(va, msg);
_vsnprintf(buf, 1024, msg, va);
va_end(va);
- strncat(buf, "\n", 1024);
- buf[1024 - 1] = 0;
+ buf[LINE - 1] = 0;
+ len = strlen (buf);
+
+ strncpy(buf + len, "\n", 1024 - len);
+ buf[LINE - 1] = 0;
OutputDebugStringA(buf);
}
@@ -262,7 +271,7 @@ CC_C_GetSlotList(CK_BBOOL tokenPresent, CK_SLOT_ID_PTR slot_list, CK_ULONG_PTR c
*count = n_tokens;
for(i = 0; i < n_tokens; ++i)
- slot_list[i] = i;
+ slot_list[i] = ckcapi_token_get_slot_id (i);
RETURN(CKR_OK);
}