diff --git a/cmdline/app.h b/cmdline/app.h index 06d35753..39e319d4 100644 --- a/cmdline/app.h +++ b/cmdline/app.h @@ -270,7 +270,7 @@ extern int exit_sync_needed; #define SMARTCTL_FLAG_SELFERROR_LOGGED (1 << 7) /**< The device self-test log contains records of errors. */ /** - * SMART max attribute length. + * SMART max attribute name or value length. */ #define SMART_MAX 128 @@ -291,7 +291,7 @@ extern int exit_sync_needed; #define SMART_ATTR_WHEN_FAILED_NEVER 64 struct smart_attr { - char name[128]; /**< SMART attribute name. */ + char name[SMART_MAX]; /**< SMART attribute name. */ uint64_t raw; /**< SMART attributes raw. It can be SMART_UNASSIGNED. */ uint64_t norm; /**< SMART attributes normalized. It can be SMART_UNASSIGNED even if raw is not. */ uint64_t worst; /**< SMART attributes worst. It can be SMART_UNASSIGNED even if raw/norm is not. */ diff --git a/cmdline/device.c b/cmdline/device.c index b7194139..2e66088b 100644 --- a/cmdline/device.c +++ b/cmdline/device.c @@ -583,9 +583,9 @@ static void state_smart_log(devinfo_t* devinfo, double afr) else if (attr->flags & SMART_ATTR_WHEN_FAILED_NEVER) when_failed = "never"; - char norm[64] = { 0 }; - char worst[64] = { 0 }; - char thresh[64] = { 0 }; + char norm[SMART_MAX] = { 0 }; + char worst[SMART_MAX] = { 0 }; + char thresh[SMART_MAX] = { 0 }; if (attr->norm != SMART_UNASSIGNED) snprintf(norm, sizeof(norm), "%" PRIu64, attr->norm); diff --git a/cmdline/support.c b/cmdline/support.c index 074d1174..347e9579 100644 --- a/cmdline/support.c +++ b/cmdline/support.c @@ -2631,13 +2631,13 @@ int smartctl_attribute(OS_FILE* f, const char* file, const char* name, struct sm } else if (smatch(s, "ID#") == 0) { inside = 1; } else if (inside) { - char id_name[128] = { 0 }; - char type[64] = { 0 }; - char updated[64] = { 0 }; - char when_failed[64] = { 0 }; - char norm[64] = { 0 }; - char worst[64] = { 0 }; - char thresh[64] = { 0 }; + char id_name[SMART_MAX] = { 0 }; + char type[SMART_MAX] = { 0 }; + char updated[SMART_MAX] = { 0 }; + char when_failed[SMART_MAX] = { 0 }; + char norm[SMART_MAX] = { 0 }; + char worst[SMART_MAX] = { 0 }; + char thresh[SMART_MAX] = { 0 }; uint64_t min, max, avg; int format_minmax = 0; int format_avg = 0; diff --git a/cmdline/unixapp.c b/cmdline/unixapp.c index 3630d0a5..9d34a5b5 100644 --- a/cmdline/unixapp.c +++ b/cmdline/unixapp.c @@ -3692,9 +3692,9 @@ int ambient_temperature(void) while ((hwmon_entry = readdir(hwmon_dir)) != NULL) { char hwmon_name[PATH_MAX]; - char value[128]; - char name[128]; - char label[128]; + char value[SMART_MAX]; + char name[SMART_MAX]; + char label[SMART_MAX]; char* dash; char* e; int temp;