aboutsummaryrefslogtreecommitdiff
path: root/src/sg_get_lba_status.c
diff options
context:
space:
mode:
authorDouglas Gilbert <dgilbert@interlog.com>2021-08-04 15:35:26 +0000
committerDouglas Gilbert <dgilbert@interlog.com>2021-08-04 15:35:26 +0000
commitcbde70fafd0ab9353e79b708621adf73420fdded (patch)
tree907f91f8803a78d13acf373658cc655ce99c1bc6 /src/sg_get_lba_status.c
parentbfbefdf2d9aa12107d08d796d6fc78862ab85402 (diff)
downloadsg3_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_get_lba_status.c')
-rw-r--r--src/sg_get_lba_status.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/sg_get_lba_status.c b/src/sg_get_lba_status.c
index 4feac63b..001d6d73 100644
--- a/src/sg_get_lba_status.c
+++ b/src/sg_get_lba_status.c
@@ -1,5 +1,5 @@
/*
- * Copyright (c) 2009-2019 Douglas Gilbert.
+ * Copyright (c) 2009-2021 Douglas Gilbert.
* All rights reserved.
* Use of this source code is governed by a BSD-style
* license that can be found in the BSD_LICENSE file.
@@ -35,7 +35,7 @@
* device.
*/
-static const char * version_str = "1.21 20190913"; /* sbc4r15 */
+static const char * version_str = "1.22 20210803"; /* sbc4r15 */
#ifndef UINT32_MAX
#define UINT32_MAX ((uint32_t)-1)
@@ -43,6 +43,7 @@ static const char * version_str = "1.21 20190913"; /* sbc4r15 */
#define MAX_GLBAS_BUFF_LEN (1024 * 1024)
#define DEF_GLBAS_BUFF_LEN 24
+#define MIN_MAXLEN 16
static uint8_t glbasFixedBuff[DEF_GLBAS_BUFF_LEN];
@@ -237,6 +238,11 @@ main(int argc, char * argv[])
}
if (0 == maxlen)
maxlen = DEF_GLBAS_BUFF_LEN;
+ else if (maxlen < MIN_MAXLEN) {
+ pr2serr("Warning: --maxlen=LEN less than %d ignored\n",
+ MIN_MAXLEN);
+ maxlen = DEF_GLBAS_BUFF_LEN;
+ }
break;
case 'r':
do_raw = true;