From 8c58594be4cb5b72ccb854a800c33bf4b8ade265 Mon Sep 17 00:00:00 2001 From: midipix Date: May 30 2024 00:41:06 +0000 Subject: driver: verifier that the request blksize is a multiple of 512 bytes. --- diff --git a/src/driver/tpax_driver_ctx.c b/src/driver/tpax_driver_ctx.c index b1393d2..6bb7545 100644 --- a/src/driver/tpax_driver_ctx.c +++ b/src/driver/tpax_driver_ctx.c @@ -242,6 +242,22 @@ static int tpax_driver_usage_block_size_range( return TPAX_USAGE; } +static int tpax_driver_usage_block_constraints( + int fdout, + const char * program, + const char * arg, + struct argv_meta * meta) +{ + tpax_dprintf( + fdout, + "%s: usage error: the specified block size `%s' is not a multiple of 512 bytes.\n", + program,arg); + + argv_free(meta); + + return TPAX_USAGE; +} + static int tpax_driver_error_archive_path( int fdout, const char * program, @@ -480,6 +496,12 @@ int tpax_lib_get_driver_ctx( fdctx->fderr, program,entry->arg, optv,meta); + + if (cctx.blksize % 512) + return tpax_driver_usage_block_constraints( + fdctx->fderr, + program,entry->arg, + meta); break; case TAG_RECURSE: