Ignore:
Timestamp:
01/16/19 18:46:44 (21 months ago)
Author:
Mark Weiman <mark.weiman@…>
Branches:
develop
Children:
fc85f33
Parents:
e4e33e9
Message:

trace_post_reporter(): fully initialize message

Valgrind complains that a call to write has a buffer that isn't fully
initialized. This is due to a possibility of the uninitialized bytes in
that structure could be sensitive memory from its previous contents.

This patch makes sure that the full libtrace_message_t gets initialized
with 0s and then proceeds to set the contents before moving on to
calling the function that calls write().

File:
1 edited

Legend:

Unmodified
Added
Removed
  • lib/trace_parallel.c

    r6d2a120 r8a6910b  
    24482448DLLEXPORT int trace_post_reporter(libtrace_t *libtrace)
    24492449{
    2450         libtrace_message_t message = {0, {.uint64=0}, NULL};
    2451         message.code = MESSAGE_POST_REPORTER;
     2450        libtrace_message_t message;
     2451        memset(&message, 0, sizeof(libtrace_message_t));
     2452        message.code = MESSAGE_POST_REPORTER;
     2453        message.data.uint64 = 0;
     2454        message.sender = NULL;
    24522455        return trace_message_reporter(libtrace, (void *) &message);
    24532456}
Note: See TracChangeset for help on using the changeset viewer.