SHA256
1
0
forked from pool/grub2
grub2/0001-unix-password-Fix-file-descriptor-leak.patch
Andrei Borzenkov 1a0ddd28c8 Accepting request 336940 from home:michael-chang:branches:Base:System
- Upstream patches for fixing file descriptor leakage (bsc#943784) 
  * added 0001-unix-password-Fix-file-descriptor-leak.patch
  * added 0002-linux-getroot-fix-descriptor-leak.patch
  * added 0003-util-grub-mount-fix-descriptor-leak.patch
  * added 0004-linux-ofpath-fix-descriptor-leak.patch
  * added 0005-grub-fstest-fix-descriptor-leak.patch

OBS-URL: https://build.opensuse.org/request/show/336940
OBS-URL: https://build.opensuse.org/package/show/Base:System/grub2?expand=0&rev=181
2015-10-12 08:10:07 +00:00

35 lines
1.0 KiB
Diff

From 810254093959708aa6a260c59ad3cf3a1d250755 Mon Sep 17 00:00:00 2001
From: Vladimir Serbinenko <phcoder@gmail.com>
Date: Mon, 26 Jan 2015 09:53:03 +0100
Subject: [PATCH] unix/password: Fix file descriptor leak.
Found by: Coverity scan.
---
grub-core/osdep/unix/password.c | 7 ++++++-
1 files changed, 6 insertions(+), 1 deletions(-)
Index: grub-2.02~beta2/grub-core/osdep/unix/password.c
===================================================================
--- grub-2.02~beta2.orig/grub-core/osdep/unix/password.c 2013-12-25 00:29:26.000000000 +0800
+++ grub-2.02~beta2/grub-core/osdep/unix/password.c 2015-09-22 17:10:01.109530851 +0800
@@ -53,7 +53,10 @@
tty_changed = 0;
grub_memset (buf, 0, buf_size);
if (!fgets (buf, buf_size, stdin))
- return 0;
+ {
+ fclose (in);
+ return 0;
+ }
ptr = buf + strlen (buf) - 1;
while (buf <= ptr && (*ptr == '\n' || *ptr == '\r'))
*ptr-- = 0;
@@ -64,5 +67,7 @@
grub_xputs ("\n");
grub_refresh ();
+ fclose (in);
+
return 1;
}