FirmwareImage: truncate name to max 64 characters

This commit is contained in:
Vivek Kumar Dutta 2023-08-29 17:39:12 +05:30
parent 659b50b5bc
commit 9799ef78d6
No known key found for this signature in database
GPG key ID: 65C818099F37097D

View file

@ -1041,7 +1041,14 @@ static int set_DeviceInfoFirmwareImage_Alias(char *refparam, struct dmctx *ctx,
static int get_DeviceInfoFirmwareImage_Name(char *refparam, struct dmctx *ctx, void *data, char *instance, char **value)
{
*value = dmjson_get_value((json_object *)data, 1, "fwver");
char *name;
name = dmstrdup(dmjson_get_value((json_object *)data, 1, "fwver"));
if (DM_STRLEN(name) > 64 ) {
name[64] = '\0';
}
*value = name;
return 0;
}