[gnome-builder] terminal: enforce trailing \0
- From: Christian Hergert <chergert src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gnome-builder] terminal: enforce trailing \0
- Date: Wed, 15 Mar 2017 20:49:03 +0000 (UTC)
commit 6734c921a3e1f271127968f90ba153985bae5d1e
Author: Christian Hergert <chergert redhat com>
Date: Wed Mar 15 13:47:44 2017 -0700
terminal: enforce trailing \0
Be defensive even though ptsname_r() says we can trust trailing \0.
plugins/terminal/gb-terminal-util.c | 1 +
1 files changed, 1 insertions(+), 0 deletions(-)
---
diff --git a/plugins/terminal/gb-terminal-util.c b/plugins/terminal/gb-terminal-util.c
index 303a897..4282fa7 100644
--- a/plugins/terminal/gb-terminal-util.c
+++ b/plugins/terminal/gb-terminal-util.c
@@ -50,6 +50,7 @@ gb_vte_pty_create_slave (VtePty *pty)
#ifdef HAVE_PTSNAME_R
if (ptsname_r (master_fd, name, sizeof name - 1) != 0)
return -1;
+ name[sizeof name - 1] = '\0';
#else
if (NULL == (name = ptsname (master_fd)))
return -1;
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]