Skip to content
This repository was archived by the owner on Mar 7, 2026. It is now read-only.

Commit 6fe4d68

Browse files
committed
hosted/bmp_serial: Prevent the RegGetValue() call that fills the output string with its value from getting compiled out when assertions are off
1 parent 571a68e commit 6fe4d68

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

src/platforms/hosted/bmp_serial.c

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ static const char *read_value_str_from_path(HKEY path_handle, const char *const
109109
{
110110
DWORD value_len = 0U;
111111
/* Start by trying to discover how long the string held by the key is */
112-
const LSTATUS result = RegGetValue(path_handle, NULL, value_name, RRF_RT_REG_SZ, NULL, NULL, &value_len);
112+
LSTATUS result = RegGetValue(path_handle, NULL, value_name, RRF_RT_REG_SZ, NULL, NULL, &value_len);
113113
/* If that didn't work, we have no hoope, so bail */
114114
if (result != ERROR_SUCCESS && result != ERROR_MORE_DATA) {
115115
display_error(result, "retrieving registry value", value_name);
@@ -126,7 +126,8 @@ static const char *read_value_str_from_path(HKEY path_handle, const char *const
126126
}
127127

128128
/* Finally, try reading the value and return it to the user if this didn't explode */
129-
assert(RegGetValue(path_handle, NULL, value_name, RRF_RT_REG_SZ, NULL, value, &value_len) == ERROR_SUCCESS);
129+
result = RegGetValue(path_handle, NULL, value_name, RRF_RT_REG_SZ, NULL, value, &value_len);
130+
assert(result == ERROR_SUCCESS);
130131
return value;
131132
}
132133

0 commit comments

Comments
 (0)