From 6899ea11475aca9ca60f77b746fc3b08272481e5 Mon Sep 17 00:00:00 2001 From: Cristian Cadar Date: Fri, 27 May 2016 11:42:01 +0100 Subject: Fixed the stub for times() not to dereference a NULL pointer when call with a NULL argument. In respose of issue https://github.com/klee/klee/issues/399 --- runtime/POSIX/stubs.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) (limited to 'runtime') diff --git a/runtime/POSIX/stubs.c b/runtime/POSIX/stubs.c index 99e2e768..b4f31bf7 100644 --- a/runtime/POSIX/stubs.c +++ b/runtime/POSIX/stubs.c @@ -174,10 +174,15 @@ time_t time(time_t *t) { clock_t times(struct tms *buf) { /* Fake */ - buf->tms_utime = 0; - buf->tms_stime = 0; - buf->tms_cutime = 0; - buf->tms_cstime = 0; + if (!buf) + klee_warning("returning 0\n"); + else { + klee_warning("setting all times to 0 and returning 0\n"); + buf->tms_utime = 0; + buf->tms_stime = 0; + buf->tms_cutime = 0; + buf->tms_cstime = 0; + } return 0; } -- cgit 1.4.1