Browse Source

In easycsv_read_value, check if row and col are valid

Signed-off-by: Pradana AUMARS <paumars@courrier.dev>
redesign
Pradana AUMARS 10 months ago
parent
commit
0793a5a1c6
  1. 10
      src/easycsv.c

10
src/easycsv.c

@ -162,12 +162,22 @@ easycsv_read_value(const easycsv *csv,
easycsv_error(EASYCSV_ZEROROW, NULL);
return NULL;
}
if (row > easycsv_print_rows(csv)) {
easycsv_error(EASYCSV_ROWNOTEXIST, NULL);
return NULL;
}
if (col == 0) {
easycsv_error(EASYCSV_ZEROCOL, NULL);
return NULL;
}
if (col > easycsv_print_columns(csv)) {
easycsv_error(EASYCSV_COLNOTEXIST, NULL);
return NULL;
}
/* Set file pointer to start */
easycsv_rewind(csv);

Loading…
Cancel
Save