In easycsv_read_value, check if row and col are valid
Signed-off-by: Pradana AUMARS <paumars@courrier.dev>
This commit is contained in:
parent
46ed839860
commit
0793a5a1c6
@ -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…
Reference in New Issue
Block a user