fix uninitialized struct data leak

This change clears the tm structure on the stack before filling it in. This guarantees that the whole structure is initialized, and as such, no uninitialized stack data is copied to the caller.
This commit is contained in:
Ilja van Sprundel 2019-10-06 21:02:10 +02:00 committed by GitHub
parent 6d152649a3
commit b3c3f2a998
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -7,6 +7,7 @@
#include <time.h>
#include <errno.h>
#include <lib.h>
#include <string.h>
#include <minix/type.h>
#include <minix/const.h>
#include <minix/callnr.h>
@ -70,6 +71,7 @@ main(int argc, char **argv)
switch (m.m_type) {
case RTCDEV_GET_TIME:
/* Any user can read the time */
memset(&t, 0x00, sizeof(t));
reply_status = rtc.get_time(&t, m.m_lc_readclock_rtcdev.flags);
if (reply_status != OK) {
break;