summaryrefslogtreecommitdiffstats
path: root/hcid/storage.c
diff options
context:
space:
mode:
authorMarcel Holtmann <marcel@holtmann.org>2005-04-16 23:37:15 +0000
committerMarcel Holtmann <marcel@holtmann.org>2005-04-16 23:37:15 +0000
commit1c47430238df9457d4dcef1cbe01ba4cf15b2b6b (patch)
treeb2d64dc5137d9406704242d7bb6f8ceb5fa28c71 /hcid/storage.c
parente81077a3fca56047992b0da3282bd06a60f07cef (diff)
Add more data checks
Diffstat (limited to 'hcid/storage.c')
-rw-r--r--hcid/storage.c12
1 files changed, 8 insertions, 4 deletions
diff --git a/hcid/storage.c b/hcid/storage.c
index 0d42d680..dad0c366 100644
--- a/hcid/storage.c
+++ b/hcid/storage.c
@@ -219,8 +219,10 @@ int write_device_name(const bdaddr_t *local, const bdaddr_t *peer, const char *n
list_foreach(list, temp) {
ba2str(&temp->bdaddr, addr);
- snprintf(buf, 300, "%s %s\n", addr, temp->data);
- write(fd, buf, strlen(buf));
+ if (temp->data && temp->size > 0) {
+ snprintf(buf, 300, "%s %s\n", addr, temp->data);
+ write(fd, buf, strlen(buf));
+ }
}
unlock:
@@ -294,8 +296,10 @@ int write_link_key(const bdaddr_t *local, const bdaddr_t *peer, const unsigned c
list_foreach(list, temp) {
ba2str(&temp->bdaddr, addr);
- snprintf(buf, 100, "%s %s\n", addr, temp->data);
- write(fd, buf, strlen(buf));
+ if (temp->data && temp->size > 0) {
+ snprintf(buf, 100, "%s %s\n", addr, temp->data);
+ write(fd, buf, strlen(buf));
+ }
}
unlock: