]> CyberLeo.Net >> Repos - FreeBSD/FreeBSD.git/commit
restore(8): Prevent some heap overflows
authorConrad Meyer <cem@FreeBSD.org>
Fri, 14 Apr 2017 00:14:40 +0000 (00:14 +0000)
committerConrad Meyer <cem@FreeBSD.org>
Fri, 14 Apr 2017 00:14:40 +0000 (00:14 +0000)
commit63298eb19c831bbede2c0453ce727e1ec681a343
treebdf7dca60d97fa6cc00b407ca2af483e8d352670
parent17fac79462ef5eacfffbfda4f36d0a4e47e22854
restore(8): Prevent some heap overflows

The environment variable TMPDIR was copied unchecked into a fixed-size heap
buffer.  Use a length-limiting snprintf in place of ordinary sprintf to
prevent the overflow.  Long TMPDIR variables can still cause odd truncated
filenames, which may be undesirable.

Reported by: Coverity (CWE-120)
CIDs: 10067061006707
Sponsored by: Dell EMC Isilon
sbin/restore/dirs.c