From 5c7809f4031c03ba1fd18c2c9f5a5438525938a5 Mon Sep 17 00:00:00 2001 From: Claudio Takahasi Date: Sat, 10 Nov 2007 18:42:03 +0000 Subject: hcid: textfile_put value must be null terminated --- hcid/dbus-sdp.c | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/hcid/dbus-sdp.c b/hcid/dbus-sdp.c index e4be89bc..73dfcbe7 100644 --- a/hcid/dbus-sdp.c +++ b/hcid/dbus-sdp.c @@ -364,11 +364,9 @@ static int sdp_store_record(const char *src, const char *dst, uint32_t handle, u create_file(filename, S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH); - snprintf(key, sizeof(key), "%s#%08X", dst, handle); + snprintf(key, sizeof(key), "%17s#%08X", dst, handle); - value = g_malloc(size * 2 + 1); - - value[0] = '\0'; + value = g_malloc0(size * 2 + 1); for (i = 0; i < size; i++) sprintf(value + (i * 2), "%02X", buf[i]); -- cgit