valeriyvdovin / rpms / systemd

Forked from rpms/systemd 4 years ago
Clone

Blame SOURCES/0066-login-fix-invalid-free-in-sd_session_get_vt.patch

572a44
From 540aab87440dbde3bf6a1d057df9c7a79adf7031 Mon Sep 17 00:00:00 2001
572a44
From: David Herrmann <dh.herrmann@gmail.com>
572a44
Date: Thu, 10 Oct 2013 13:09:37 +0200
572a44
Subject: [PATCH] login: fix invalid free() in sd_session_get_vt()
572a44
572a44
We need to clear variables markes as _cleanup_free_. Otherwise, our
572a44
error-paths might corrupt random memory.
572a44
---
572a44
 src/login/sd-login.c | 2 +-
572a44
 1 file changed, 1 insertion(+), 1 deletion(-)
572a44
572a44
diff --git a/src/login/sd-login.c b/src/login/sd-login.c
572a44
index 71d8c29..6c27dfe 100644
572a44
--- a/src/login/sd-login.c
572a44
+++ b/src/login/sd-login.c
572a44
@@ -350,7 +350,7 @@ _public_ int sd_session_get_tty(const char *session, char **tty) {
572a44
 }
572a44
 
572a44
 _public_ int sd_session_get_vt(const char *session, unsigned *vtnr) {
572a44
-        _cleanup_free_ char *vtnr_string;
572a44
+        _cleanup_free_ char *vtnr_string = NULL;
572a44
         unsigned u;
572a44
         int r;
572a44