From 5966fcf5ff1bedd37e39d609c5f01b51ddef636c Mon Sep 17 00:00:00 2001
From: jrandom <jrandom>
Date: Sun, 4 Dec 2005 20:12:19 +0000
Subject: [PATCH] 2005-12-04  TLorD     * Patch for the C SAM library to null
 terminate strings on copy (thanks!)

---
 apps/sam/c/src/tinystring.c | 1 +
 history.txt                 | 5 ++++-
 2 files changed, 5 insertions(+), 1 deletion(-)

diff --git a/apps/sam/c/src/tinystring.c b/apps/sam/c/src/tinystring.c
index 395a50a885..cbbbbfc2c1 100644
--- a/apps/sam/c/src/tinystring.c
+++ b/apps/sam/c/src/tinystring.c
@@ -90,6 +90,7 @@ void string_copy(string_t src,string_t dest) {
 void string_copy_raw(string_t src, void* dest,size_t size) {
     size = min(src->size,size);
     memcpy(dest,src->data,size);
+    ((char*)dest)[size] = '\0';
 }
 
 const char* string_data(string_t self) {
diff --git a/history.txt b/history.txt
index a7291507a6..5c8e79f424 100644
--- a/history.txt
+++ b/history.txt
@@ -1,4 +1,7 @@
-$Id: history.txt,v 1.345 2005/12/03 22:18:09 jrandom Exp $
+$Id: history.txt,v 1.346 2005/12/04 15:02:25 jrandom Exp $
+
+2005-12-04  TLorD
+    * Patch for the C SAM library to null terminate strings on copy (thanks!)
 
 2005-12-04  jrandom
     * Bugfix in Syndie for a problem in the threaded indexer (thanks CofE!)
-- 
GitLab