From 45476d093cdea0aad0668bf5ecac0ec4bd34d970 Mon Sep 17 00:00:00 2001 From: Albrecht Schlosser Date: Wed, 19 Feb 2025 17:14:25 +0100 Subject: test/editor: ensure buffer termination ... in source file and documentation --- test/editor.cxx | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'test/editor.cxx') diff --git a/test/editor.cxx b/test/editor.cxx index 043066108..c989b9dd7 100644 --- a/test/editor.cxx +++ b/test/editor.cxx @@ -4,7 +4,7 @@ // This program is described in chapter "Designing a Simple Text Editor" // of the FLTK Programmer's Guide. // -// Copyright 1998-2024 by Bill Spitzak and others. +// Copyright 1998-2025 by Bill Spitzak and others. // // This library is free software. Distribution and use rights are outlined in // the file "COPYING" which should have been included with this file. If this @@ -61,6 +61,7 @@ void update_title() { fname = fl_filename_name(app_filename); if (fname) { char buf[FL_PATH_MAX + 3]; + buf[FL_PATH_MAX + 2] = '\0'; // ensure that the buffer is always terminated if (text_changed) { snprintf(buf, FL_PATH_MAX+2, "%s *", fname); } else { -- cgit v1.2.3