Source-Changes archive
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]
CVS commit: src/external/bsd/top/dist/machine
Module Name: src
Committed By: kamil
Date: Thu May 31 10:14:21 UTC 2018
Modified Files:
src/external/bsd/top/dist/machine: m_netbsd.c
Log Message:
Fix read of unitialized array elements in top(1)
The cp_old array is allocated with malloc(3) and its pointer is passed to
percentages64().
In this function there happens a calculation of total_change, which value
depends on the value inside the unitialized cp_old[] array.
==26662==WARNING: MemorySanitizer: use-of-uninitialized-value
#0 0x268a2c in percentages64 /usr/src/external/bsd/top/bin/../dist/machine/m_netbsd.c:1341:6
#1 0x26748b in get_system_info /usr/src/external/bsd/top/bin/../dist/machine/m_netbsd.c:478:6
#2 0x25518e in do_display /usr/src/external/bsd/top/bin/../dist/top.c:507:5
#3 0x253038 in main /usr/src/external/bsd/top/bin/../dist/top.c:975:2
#4 0x21cad1 in ___start (/usr/bin/top+0x1cad1)
SUMMARY: MemorySanitizer: use-of-uninitialized-value /usr/src/external/bsd/top/bin/../dist/machine/m_netbsd.c:1341:6 in percentages64
Exiting
Fix this issue by changling malloc(3) with calloc(3).
Detected with Memory Sanitizer during the integration of sanitizers with
the NetBSD basesystem.
Reported by <Yang Zheng>
To generate a diff of this commit:
cvs rdiff -u -r1.19 -r1.20 src/external/bsd/top/dist/machine/m_netbsd.c
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Home |
Main Index |
Thread Index |
Old Index