diff options
author | Douglas Gilbert <dgilbert@interlog.com> | 2021-08-04 15:35:26 +0000 |
---|---|---|
committer | Douglas Gilbert <dgilbert@interlog.com> | 2021-08-04 15:35:26 +0000 |
commit | cbde70fafd0ab9353e79b708621adf73420fdded (patch) | |
tree | 907f91f8803a78d13acf373658cc655ce99c1bc6 /src/sg_vpd.c | |
parent | bfbefdf2d9aa12107d08d796d6fc78862ab85402 (diff) | |
download | sg3_utils-cbde70fafd0ab9353e79b708621adf73420fdded.tar.gz |
sg_ses: guard against small '--maxlen=' values
In several utilities guard against '--maxlen=' < 4 or < 16
as they seem to serve no useful purpose other than finding
awkward corner cases that may trip up these utilities.
git-svn-id: https://svn.bingwo.ca/repos/sg3_utils/trunk@908 6180dd3e-e324-4e3e-922d-17de1ae2f315
Diffstat (limited to 'src/sg_vpd.c')
-rw-r--r-- | src/sg_vpd.c | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/src/sg_vpd.c b/src/sg_vpd.c index 36fd0de5..21d412c9 100644 --- a/src/sg_vpd.c +++ b/src/sg_vpd.c @@ -40,7 +40,7 @@ */ -static const char * version_str = "1.65 20210630"; /* spc6r05 + sbc5r01 */ +static const char * version_str = "1.66 20210702"; /* spc6r05 + sbc5r01 */ /* standard VPD pages, in ascending page number order */ #define VPD_SUPPORTED_VPDS 0x0 @@ -95,6 +95,7 @@ static const char * version_str = "1.65 20210630"; /* spc6r05 + sbc5r01 */ #define VPD_DI_SEL_AS_IS 32 #define DEF_ALLOC_LEN 252 +#define MIN_MAXLEN 16 #define MX_ALLOC_LEN (0xc000 + 0x80) #define VPD_ATA_INFO_LEN 572 @@ -3824,6 +3825,11 @@ main(int argc, char * argv[]) MX_ALLOC_LEN); return SG_LIB_SYNTAX_ERROR; } + if ((op->maxlen > 0) && (op->maxlen < MIN_MAXLEN)) { + pr2serr("Warning: overriding '--maxlen' < %d, using " + "default\n", MIN_MAXLEN); + op->maxlen = 0; + } break; case 'M': if (op->vend_prod) { |