sc-hsm: Fixed memory checking and removed warning
This commit is contained in:
parent
f09dae493c
commit
4604dac3a7
|
@ -607,9 +607,10 @@ static int sc_hsm_get_serialnr(sc_card_t *card, sc_serial_number_t *serial)
|
|||
}
|
||||
|
||||
serial->len = strlen(priv->serialno);
|
||||
/* FIXME the length to copy should be dependant on the size of
|
||||
* serial->value *and* priv->serialno */
|
||||
strncpy(serial->value, priv->serialno, sizeof(serial->value));
|
||||
if (serial->len > sizeof(serial->value))
|
||||
serial->len = sizeof(serial->value);
|
||||
|
||||
memcpy(serial->value, priv->serialno, serial->len);
|
||||
|
||||
LOG_FUNC_RETURN(card->ctx, SC_SUCCESS);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue