SHA256
1
0
forked from pool/tboot
tboot/tboot-fix-alloc-size-warning.patch
Matthias Gerstner 3f42461b8c - add tboot-fix-alloc-size-warning.patch: newest GCC spits out this error:
```
  pconf_legacy.c: In function ‘create’:
  pconf_legacy.c:327:16: error: allocation of insufficient size ‘20’ for type ‘tb_hash_t’ with size ‘64’ [-Werror=alloc-size]
  327 |         digest = malloc(SHA1_DIGEST_SIZE);
      |                ^
  ```
  There's a union data type behind this. It's not an actual error. To get rid
  of the warning, the patch allocates the full union size, thereby wasting a
  bit of memory.

OBS-URL: https://build.opensuse.org/package/show/security/tboot?expand=0&rev=120
2024-08-28 08:45:07 +00:00

14 lines
582 B
Diff

Index: tboot-1.11.4/lcptools-v2/pconf_legacy.c
===================================================================
--- tboot-1.11.4.orig/lcptools-v2/pconf_legacy.c
+++ tboot-1.11.4/lcptools-v2/pconf_legacy.c
@@ -324,7 +324,7 @@ static lcp_policy_element_t *create(void
ERROR("Error: no pcrs were selected.\n");
return NULL;
}
- digest = malloc(SHA1_DIGEST_SIZE);
+ digest = malloc(sizeof(*digest));
if (digest == NULL) {
ERROR("Error: failed to allocate memory for digest buffer.\n");
return NULL;