do a memcpy only if source and dest are different

git-svn-id: https://www.opensc-project.org/svnp/opensc/trunk@2009 c6295689-39f2-0310-b995-f0e70906c6a9
This commit is contained in:
nils 2004-12-13 20:58:28 +00:00
parent 7a0738ecb6
commit 8e05d3eabb
1 changed files with 2 additions and 1 deletions

View File

@ -225,7 +225,8 @@ int sc_pkcs1_encode(struct sc_context *ctx, unsigned long flags,
switch(pad_algo) {
case SC_ALGORITHM_RSA_PAD_NONE:
/* padding done by card => nothing to do */
memcpy(out, tmp, tmp_len);
if (out != tmp)
memcpy(out, tmp, tmp_len);
*out_len = tmp_len;
return SC_SUCCESS;
case SC_ALGORITHM_RSA_PAD_PKCS1: