File: 0014-use-snprintf-instead-of-strncpy.patch

package info (click to toggle)
ippl 1.4.14-14
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 848 kB
  • sloc: ansic: 1,683; yacc: 443; sh: 320; lex: 163; makefile: 93
file content (21 lines) | stat: -rw-r--r-- 606 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
From: Marc Haber <mh+debian-packages@zugschlus.de>
Date: Wed, 18 Jun 2025 21:26:18 +0200
Subject: use snprintf instead of strncpy

---
 Source/log.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/Source/log.c b/Source/log.c
index 7d6a2af..a980bbe 100644
--- a/Source/log.c
+++ b/Source/log.c
@@ -161,7 +161,7 @@ void log_entry(int fd, char *entry) {
   write(fd, entry, (strlen(entry) < 1023) ? strlen(entry) : 1023 );
   write(fd, "\n", 1);
 
-  strncpy(last_message, entry, BUFFER_SIZE);
+  snprintf(last_message, BUFFER_SIZE, "%s", entry);
 
   pthread_mutex_unlock(&log_mutex);
 }