From: anonymix007 <48598263+anonymix007@users.noreply.github.com> Date: Wed, 6 Nov 2024 20:12:07 +0000 (+0300) Subject: fundamental: Fix buffer size in get_chid X-Git-Tag: v257-rc2~44^2 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=310997d5b4415f88e7a640eb5d1099012b531911;p=thirdparty%2Fsystemd.git fundamental: Fix buffer size in get_chid NUL byte should not be hashed --- diff --git a/src/fundamental/chid-fundamental.c b/src/fundamental/chid-fundamental.c index 3aa444ab887..01045176f52 100644 --- a/src/fundamental/chid-fundamental.c +++ b/src/fundamental/chid-fundamental.c @@ -20,7 +20,7 @@ # include # include # include -#define strsize16(str) ((char16_strlen(str) + 1) * sizeof(char16_t)) +#define strlen16 char16_strlen #endif #include "chid-fundamental.h" @@ -42,7 +42,7 @@ static void get_chid(const char16_t *const smbios_fields[static _CHID_SMBIOS_FIE if ((mask >> i) & 1) { if (i > 0) sha1_process_bytes(L"&", 2, &ctx); - sha1_process_bytes(smbios_fields[i], strsize16(smbios_fields[i]), &ctx); + sha1_process_bytes(smbios_fields[i], strlen16(smbios_fields[i]) * sizeof(char16_t), &ctx); } uint8_t hash[SHA1_DIGEST_SIZE];