aboutsummaryrefslogtreecommitdiffstats
path: root/libcontacts_load_contact.c
diff options
context:
space:
mode:
authorMattias Andrée <maandree@kth.se>2021-04-02 18:01:31 +0200
committerMattias Andrée <maandree@kth.se>2021-04-02 18:01:31 +0200
commit41a918ed1b679b23c91ff22edac3044a10163fb3 (patch)
treeaaf5d2c277de71de05afda03c8ac6a93b98fcab2 /libcontacts_load_contact.c
parentAdd block info (diff)
downloadlibcontacts-41a918ed1b679b23c91ff22edac3044a10163fb3.tar.gz
libcontacts-41a918ed1b679b23c91ff22edac3044a10163fb3.tar.bz2
libcontacts-41a918ed1b679b23c91ff22edac3044a10163fb3.tar.xz
m
Signed-off-by: Mattias Andrée <maandree@kth.se>
Diffstat (limited to 'libcontacts_load_contact.c')
-rw-r--r--libcontacts_load_contact.c3
1 files changed, 2 insertions, 1 deletions
diff --git a/libcontacts_load_contact.c b/libcontacts_load_contact.c
index 2d6f933..0821871 100644
--- a/libcontacts_load_contact.c
+++ b/libcontacts_load_contact.c
@@ -30,6 +30,7 @@ libcontacts_load_contact(const char *id, struct libcontacts_contact *contact, co
if (!new)
goto fail;
n += 8 << 10;
+ data = new;
}
r = read(fd, &data[p], n - p);
if (r <= 0) {
@@ -41,7 +42,7 @@ libcontacts_load_contact(const char *id, struct libcontacts_contact *contact, co
}
data[p] = '\0';
- if (memchr(data, 0, p)) {
+ if (memchr(data, '\0', p)) {
errno = 0;
goto fail;
}