mirror of
https://github.com/Mbed-TLS/mbedtls.git
synced 2025-04-10 15:45:34 +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 read_uninitialized_stack(const char *name)
|
||||||
{
|
{
|
||||||
(void) name;
|
(void) name;
|
||||||
volatile char buf[1];
|
char buf[1];
|
||||||
if (false_but_the_compiler_does_not_know) {
|
if (false_but_the_compiler_does_not_know) {
|
||||||
buf[0] = '!';
|
buf[0] = '!';
|
||||||
}
|
}
|
||||||
if (*buf != 0) {
|
char *volatile p = buf;
|
||||||
mbedtls_printf("%u\n", (unsigned) *buf);
|
if (*p != 0) {
|
||||||
|
mbedtls_printf("%u\n", (unsigned) *p);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user