fixed out of bounds read

This commit is contained in:
Frank Morgner 2015-01-28 05:59:41 +01:00
parent 7c497b324f
commit 027e4a0867
2 changed files with 2 additions and 2 deletions

View File

@ -840,7 +840,7 @@ int sc_set_card_driver(sc_context_t *ctx, const char *short_name)
if (short_name == NULL) {
ctx->forced_driver = NULL;
match = 1;
} else while (ctx->card_drivers[i] != NULL && i < SC_MAX_CARD_DRIVERS) {
} else while (i < SC_MAX_CARD_DRIVERS && ctx->card_drivers[i] != NULL) {
struct sc_card_driver *drv = ctx->card_drivers[i];
if (strcmp(short_name, drv->short_name) == 0) {

View File

@ -768,7 +768,7 @@ static unsigned long part10_detect_pace_capabilities(sc_reader_t *reader)
PACE_FUNCTION_GetReaderPACECapabilities, /* idxFunction */
0, 0, /* lengthInputData */
};
u8 rbuf[6];
u8 rbuf[7];
u8 *p = rbuf;
size_t rcount = sizeof rbuf;
struct pcsc_private_data *priv;