From 03ea85dc688f42734528c3d735d84e4f803dd541 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=97=84=ED=83=9C=EC=9A=A9?= Date: Tue, 1 Jul 2025 18:26:07 +0900 Subject: [PATCH] [FIX] Prevent NULL dereference in read_restore() via hcmalloc --- src/restore.c | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/restore.c b/src/restore.c index f2a59f7c1..2ca95ba92 100644 --- a/src/restore.c +++ b/src/restore.c @@ -89,6 +89,14 @@ static int read_restore (hashcat_ctx_t *hashcat_ctx) char *buf = (char *) hcmalloc (HCBUFSIZ_LARGE); + if (buf == NULL) + { + event_log_error(hashcat_ctx, "hcmalloc: %s", strerror(errno)); + hc_fclose(&fp); + hcfree(rd->argv); + return -1; + } + for (u32 i = 0; i < rd->argc; i++) { if (hc_fgets (buf, HCBUFSIZ_LARGE - 1, &fp) == NULL)