check parameters in strcpy_bp

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@1760 c6295689-39f2-0310-b995-f0e70906c6a9
This commit is contained in:
aj 2004-03-29 20:34:30 +00:00
parent 37a957cbe4
commit 6e15c2421e
1 changed files with 8 additions and 3 deletions

View File

@ -26,11 +26,16 @@
void strcpy_bp(u8 *dst, const char *src, int dstsize)
{
int c = strlen(src) > dstsize ? dstsize : strlen(src);
int c;
if (!dst || !src || !dstsize)
return;
memset((char *) dst, ' ', dstsize);
c = strlen(src) > dstsize ? dstsize : strlen(src);
memcpy((char *) dst, src, c);
dstsize -= c;
memset((char *) dst + c, ' ', dstsize);
}
CK_RV sc_to_cryptoki_error(int rc, int reader)