1
0
Fork 0

Adding upstream version 2.13.

Signed-off-by: Daniel Baumann <daniel@debian.org>
This commit is contained in:
Daniel Baumann 2025-04-13 11:50:33 +02:00
parent c0fbec1eb4
commit 94a061187a
Signed by: daniel
GPG key ID: FBB4F0E80A80222F
579 changed files with 6165 additions and 1687 deletions

View file

@ -464,15 +464,19 @@ void json_add_formatted_u32_str(struct json_object *pobject, const char *msg, un
void json_add_formatted_var_size_str(struct json_object *pobject, const char *msg, __u8 *pdata,
unsigned int data_size)
{
char description_str[256] = "";
char *description_str = NULL;
char temp_buffer[3] = { 0 };
/* Allocate 2 chars for each value in the data + 2 bytes for the null terminator */
description_str = (char *) calloc(1, data_size*2 + 2);
for (size_t i = 0; i < data_size; ++i) {
sprintf(temp_buffer, "%02X", pdata[i]);
strcat(description_str, temp_buffer);
}
json_object_add_value_string(pobject, msg, description_str);
free(description_str);
}
#endif /* CONFIG_JSONC */