mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-03-29 13:20:21 +00:00
Uninitialized read: make the pointer non-volatile rather than the buffer
Signed-off-by: Gilles Peskine <Gilles.Peskine@arm.com>
This commit is contained in:
parent
da6e7a2ac2
commit
ccb121500d
@ -96,12 +96,13 @@ void double_free(const char *name)
|
||||
void read_uninitialized_stack(const char *name)
|
||||
{
|
||||
(void) name;
|
||||
volatile char buf[1];
|
||||
char buf[1];
|
||||
if (false_but_the_compiler_does_not_know) {
|
||||
buf[0] = '!';
|
||||
}
|
||||
if (*buf != 0) {
|
||||
mbedtls_printf("%u\n", (unsigned) *buf);
|
||||
char *volatile p = buf;
|
||||
if (*p != 0) {
|
||||
mbedtls_printf("%u\n", (unsigned) *p);
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user