Use correct data structure for ZIP_SOURCE_SEEK_WRITE arguments. Found by Wojciech Michalski.
diff --git a/THANKS b/THANKS index 3d973ab..81db0c1 100644 --- a/THANKS +++ b/THANKS
@@ -42,3 +42,4 @@ Vassili Courzakis <vcoxvco@googlemail.com> Wojciech Michalski <wmichalski@quay.pl> Wolfgang Glunz <Wolfgang.Glunz@gmx.de> +Wojciech Michalski <wmichalski@quay.pl>
diff --git a/lib/zip_source_filep.c b/lib/zip_source_filep.c index 6a613f1..3295fa0 100644 --- a/lib/zip_source_filep.c +++ b/lib/zip_source_filep.c
@@ -364,16 +364,14 @@ } case ZIP_SOURCE_SEEK_WRITE: { - zip_int64_t offset, whence; + zip_source_args_seek_t *args; - if (len < sizeof(zip_int64_t)*2) { - zip_error_set(&ctx->error, ZIP_ER_INVAL, 0); + args = ZIP_SOURCE_GET_ARGS(zip_source_args_seek_t, data, len, &ctx->error); + if (args == NULL) { return -1; } - offset = ((zip_int64_t *)data)[0]; - whence = ((zip_int64_t *)data)[1]; - - if (fseeko(ctx->fout, offset, (int)whence) < 0) { + + if (fseeko(ctx->fout, args->offset, args->whence) < 0) { zip_error_set(&ctx->error, ZIP_ER_SEEK, errno); return -1; }