Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12-SP2:GA
libvirt.11696
libvirt-util-add-virFileReadHeaderQuiet-wrapper...
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File libvirt-util-add-virFileReadHeaderQuiet-wrapper-around-virFileReadHeaderFD.patch of Package libvirt.11696
From 5c553cc45f0da07f729be7d4b5260a29d4552abd Mon Sep 17 00:00:00 2001 Message-Id: <5c553cc45f0da07f729be7d4b5260a29d4552abd@dist-git> From: Paolo Bonzini <pbonzini@redhat.com> Date: Tue, 12 Dec 2017 16:23:40 +0100 Subject: [PATCH] util: add virFileReadHeaderQuiet wrapper around virFileReadHeaderFD CVE-2017-5715 Signed-off-by: Paolo Bonzini <pbonzini@redhat.com> Signed-off-by: Jiri Denemark <jdenemar@redhat.com> --- src/libvirt_private.syms | 1 + src/util/virfile.c | 19 +++++++++++++++++++ src/util/virfile.h | 2 ++ 3 files changed, 22 insertions(+) Index: libvirt-1.2.18.4/src/libvirt_private.syms =================================================================== --- libvirt-1.2.18.4.orig/src/libvirt_private.syms +++ libvirt-1.2.18.4/src/libvirt_private.syms @@ -1444,6 +1444,7 @@ virFilePrintf; virFileReadAll; virFileReadAllQuiet; virFileReadHeaderFD; +virFileReadHeaderQuiet; virFileReadLimFD; virFileRelLinkPointsTo; virFileResolveAllLinks; Index: libvirt-1.2.18.4/src/util/virfile.c =================================================================== --- libvirt-1.2.18.4.orig/src/util/virfile.c +++ libvirt-1.2.18.4/src/util/virfile.c @@ -1339,6 +1339,25 @@ virFileReadHeaderFD(int fd, int maxlen, } +int +virFileReadHeaderQuiet(const char *path, + int maxlen, + char **buf) +{ + int fd; + int len; + + fd = open(path, O_RDONLY); + if (fd < 0) + return -1; + + len = virFileReadHeaderFD(fd, maxlen, buf); + VIR_FORCE_CLOSE(fd); + + return len; +} + + /* A wrapper around saferead_lim that maps a failure due to exceeding the maximum size limitation to EOVERFLOW. */ int Index: libvirt-1.2.18.4/src/util/virfile.h =================================================================== --- libvirt-1.2.18.4.orig/src/util/virfile.h +++ libvirt-1.2.18.4/src/util/virfile.h @@ -125,6 +125,8 @@ int virFileDeleteTree(const char *dir); int virFileReadHeaderFD(int fd, int maxlen, char **buf) ATTRIBUTE_RETURN_CHECK ATTRIBUTE_NONNULL(3); +int virFileReadHeaderQuiet(const char *path, int maxlen, char **buf) + ATTRIBUTE_RETURN_CHECK ATTRIBUTE_NONNULL(1) ATTRIBUTE_NONNULL(3); int virFileReadLimFD(int fd, int maxlen, char **buf) ATTRIBUTE_RETURN_CHECK ATTRIBUTE_NONNULL(3); int virFileReadAll(const char *path, int maxlen, char **buf)
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor