Add null checks for filename and image_stream in aaruf_identify functions

This commit is contained in:
2025-10-08 19:40:38 +01:00
parent 4595fbb4ac
commit 709543a37d

View File

@@ -83,6 +83,8 @@
*/ */
int aaruf_identify(const char *filename) int aaruf_identify(const char *filename)
{ {
if(filename == NULL) return EINVAL;
FILE *stream = NULL; FILE *stream = NULL;
stream = fopen(filename, "rb"); stream = fopen(filename, "rb");
@@ -160,7 +162,9 @@ int aaruf_identify(const char *filename)
*/ */
int aaruf_identify_stream(FILE *image_stream) int aaruf_identify_stream(FILE *image_stream)
{ {
fseek(image_stream, 0, SEEK_SET); if(image_stream == NULL) return 0;
if(fseek(image_stream, 0, SEEK_SET) != 0) return 0;
AaruHeader header; AaruHeader header;