aboutsummaryrefslogtreecommitdiffstats
path: root/src/pgtkterm.c
diff options
context:
space:
mode:
authorPaul Eggert2025-01-21 22:19:08 -0800
committerPaul Eggert2025-01-21 22:31:00 -0800
commitdb9ea9b77a0d03342bfe2a976b3943de5e5a4518 (patch)
tree46244e611ed9f9ef192614873a6192a45f0eab52 /src/pgtkterm.c
parent4a25ed300fec579f8fc75a53edbd9a6f74e2d44f (diff)
downloademacs-db9ea9b77a0d03342bfe2a976b3943de5e5a4518.tar.gz
emacs-db9ea9b77a0d03342bfe2a976b3943de5e5a4518.zip
Check for snprintf truncation in pgtkterm
* src/pgtkterm.c (pgtk_enumerate_devices): Abort if snprintf truncated.
Diffstat (limited to 'src/pgtkterm.c')
-rw-r--r--src/pgtkterm.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/src/pgtkterm.c b/src/pgtkterm.c
index 413cbd86c0d..30679353c1b 100644
--- a/src/pgtkterm.c
+++ b/src/pgtkterm.c
@@ -183,9 +183,10 @@ pgtk_enumerate_devices (struct pgtk_display_info *dpyinfo,
183 rec->seat = g_object_ref (seat); 183 rec->seat = g_object_ref (seat);
184 rec->device = GDK_DEVICE (t1->data); 184 rec->device = GDK_DEVICE (t1->data);
185 185
186 snprintf (printbuf, 1026, "%u:%s", 186 int len = snprintf (printbuf, sizeof printbuf, "%u:%s",
187 gdk_device_get_source (rec->device), 187 gdk_device_get_source (rec->device),
188 gdk_device_get_name (rec->device)); 188 gdk_device_get_name (rec->device));
189 eassert (len < sizeof printbuf);
189 190
190 rec->name = build_string (printbuf); 191 rec->name = build_string (printbuf);
191 rec->next = dpyinfo->devices; 192 rec->next = dpyinfo->devices;