mirror of
https://github.com/guanzhi/GmSSL.git
synced 2026-05-06 16:36:16 +08:00
Add error checking in pem.c
This commit is contained in:
@@ -76,13 +76,15 @@ int pem_read(FILE *fp, const char *name, uint8_t *data, size_t *datalen, size_t
|
||||
snprintf(end_line, sizeof(end_line), "-----END %s-----", name);
|
||||
|
||||
if (feof(fp)) {
|
||||
error_print();
|
||||
return 0;
|
||||
}
|
||||
|
||||
if (!fgets(line, sizeof(line), fp)) {
|
||||
if (feof(fp))
|
||||
if (feof(fp)) {
|
||||
error_print();
|
||||
return 0;
|
||||
else {
|
||||
} else {
|
||||
error_print();
|
||||
return -1;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user