File: zero-initialize-cgreen-value.patch

package info (click to toggle)
cgreen 1.6.4-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,592 kB
  • sloc: ansic: 12,267; sh: 555; makefile: 468; cpp: 403; python: 181; xml: 33; sed: 13
file content (23 lines) | stat: -rw-r--r-- 853 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
Description: Fix uninitialized value in make_cgreen_integer_value
 The make_cgreen_integer_value() function could leave parts of the
 CgreenValue.value union uninitialized. This was investigated as a
 potential fix for a build failure observed on the i386 architecture
 within the Debian Sid packaging environment.
Author: Gavin Lai <gavin09@gmail.com>
Last-Update: 2025-09-08
Forwarded: https://github.com/cgreen-devs/cgreen/pull/334
---
--- a/src/cgreen_value.c
+++ b/src/cgreen_value.c
@@ -18,7 +18,10 @@
 }
 
 CgreenValue make_cgreen_integer_value(intptr_t integer) {
-    CgreenValue value = {CGREEN_INTEGER, {0}, sizeof(intptr_t)};
+    CgreenValue value;
+    value.type = CGREEN_INTEGER;
+    value.value_size = sizeof(intptr_t);
+    memset(&value.value, 0, sizeof(value.value));
     value.value.integer_value = integer;
     return value;
 }