libsm: fixed out of bounds write
`sm_incr_ssc` performed an out of bounds write when `ssc` is bigger than 255. The local variable `ii` needs to be decremented instead of incremented in the `for`-loop. This was introduced ind30cd83a
, wheras The previous implementation did actually decrement `ii`, seed30cd83ad4
Fixes https://github.com/OpenSC/OpenSC/issues/785
This commit is contained in:
parent
4441efa6da
commit
e98315a196
@ -359,7 +359,7 @@ sm_incr_ssc(unsigned char *ssc, size_t ssc_len)
|
||||
if (!ssc)
|
||||
return;
|
||||
|
||||
for (ii = ssc_len - 1;ii >= 0; ii++) {
|
||||
for (ii = ssc_len - 1; ii >= 0; ii--) {
|
||||
*(ssc + ii) += 1;
|
||||
if (*(ssc + ii) != 0)
|
||||
break;
|
||||
|
Loading…
Reference in New Issue
Block a user