Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
SUSE:SLE-12-SP2:GA
qemu-linux-user.7445
0369-9pfs-remove-side-effects-in-local_o.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0369-9pfs-remove-side-effects-in-local_o.patch of Package qemu-linux-user.7445
From b968732e4963ee76ddf30b933bac3b9fc8df7556 Mon Sep 17 00:00:00 2001 From: Greg Kurz <groug@kaod.org> Date: Sun, 26 Feb 2017 23:41:55 +0100 Subject: [PATCH] 9pfs: remove side-effects in local_open() and local_opendir() If these functions fail, they should not change *fs. Let's use local variables to fix this. Signed-off-by: Greg Kurz <groug@kaod.org> Reviewed-by: Stefan Hajnoczi <stefanha@redhat.com> (cherry picked from commit 21328e1e57f526e3f0c2fcd00f10c8aa6e7bc07f) [BR: Fix and/or infrastructure for BSC#1020427 CVE-2016-9602] Signed-off-by: Bruce Rogers <brogers@suse.com> --- hw/9pfs/9p-local.c | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/hw/9pfs/9p-local.c b/hw/9pfs/9p-local.c index 648a0ad5a2..b2f4aa0477 100644 --- a/hw/9pfs/9p-local.c +++ b/hw/9pfs/9p-local.c @@ -355,10 +355,15 @@ static int local_open(FsContext *ctx, V9fsPath *fs_path, { char *buffer; char *path = fs_path->data; + int fd; buffer = rpath(ctx, path); - fs->fd = open(buffer, flags | O_NOFOLLOW); + fd = open(buffer, flags | O_NOFOLLOW); g_free(buffer); + if (fd == -1) { + return -1; + } + fs->fd = fd; return fs->fd; } @@ -367,13 +372,15 @@ static int local_opendir(FsContext *ctx, { char *buffer; char *path = fs_path->data; + DIR *stream; buffer = rpath(ctx, path); - fs->dir.stream = opendir(buffer); + stream = opendir(buffer); g_free(buffer); - if (!fs->dir.stream) { + if (!stream) { return -1; } + fs->dir.stream = stream; return 0; }
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