summaryrefslogtreecommitdiffstats
path: root/hcid
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2005-04-16 23:43:36 +0000
committerMarcel Holtmann <marcel@holtmann.org>2005-04-16 23:43:36 +0000
commit6cffeb529a602566218343c35b6f1dbe5a5e057f (patch)
tree4f89f091e12b019631597d11b06445e361dee1ef /hcid
parent1c47430238df9457d4dcef1cbe01ba4cf15b2b6b (diff)
Clear buffer before creating new line
Diffstat (limited to 'hcid')
-rw-r--r--hcid/storage.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/hcid/storage.c b/hcid/storage.c
index dad0c366..952d8f7d 100644
--- a/hcid/storage.c
+++ b/hcid/storage.c
@@ -220,7 +220,8 @@ int write_device_name(const bdaddr_t *local, const bdaddr_t *peer, const char *n
list_foreach(list, temp) {
ba2str(&temp->bdaddr, addr);
if (temp->data && temp->size > 0) {
- snprintf(buf, 300, "%s %s\n", addr, temp->data);
+ memset(buf, 0, 300);
+ snprintf(buf, 299, "%s %s\n", addr, temp->data);
write(fd, buf, strlen(buf));
}
}
@@ -297,7 +298,8 @@ int write_link_key(const bdaddr_t *local, const bdaddr_t *peer, const unsigned c
list_foreach(list, temp) {
ba2str(&temp->bdaddr, addr);
if (temp->data && temp->size > 0) {
- snprintf(buf, 100, "%s %s\n", addr, temp->data);
+ memset(buf, 0, 100);
+ snprintf(buf, 99, "%s %s\n", addr, temp->data);
write(fd, buf, strlen(buf));
}
}