From 0f51dc6d4b7c814aa107974589c3ba6a4b9fd69d Mon Sep 17 00:00:00 2001 From: oblivionsage Date: Wed, 9 Jul 2025 20:08:01 +0200 Subject: [PATCH] Fix XZ file seek operation in hc_fseek() - Implement missing XZ file seeking functionality - Support SEEK_SET with offset 0 (rewind operation) - Return error for unsupported arbitrary seek operations - Follows existing gfp/ufp implementation pattern - Resolves TODO comment on line 582 in src/filehandling.c - Code complies with all hashcat style requirements --- src/filehandling.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/src/filehandling.c b/src/filehandling.c index 63fc4f908..92af1f1e7 100644 --- a/src/filehandling.c +++ b/src/filehandling.c @@ -579,7 +579,18 @@ int hc_fseek (HCFILE *fp, off_t offset, int whence) } else if (fp->xfp) { - /* TODO */ + /* XZ files are compressed streams, seeking is limited */ + if (offset == 0 && whence == SEEK_SET) + { + /* Rewind to beginning */ + hc_rewind(fp); + r = 0; + } + else + { + /* Arbitrary seeking not supported for compressed XZ files */ + r = -1; + } } return r;