Skip to content

Commit

Permalink
vcard_test.c: use read() result
Browse files Browse the repository at this point in the history
  • Loading branch information
ksmurchison committed Apr 22, 2024
1 parent 55f1060 commit 0693130
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/test/libicalvcard/vcard_test.c
Original file line number Diff line number Diff line change
Expand Up @@ -53,8 +53,12 @@ int main(int argc, const char **argv)
fstat(fd, &sbuf);
data = malloc(sbuf.st_size+1);

read(fd, data, sbuf.st_size);
data[sbuf.st_size] = '\0';
int r = read(fd, data, sbuf.st_size);
if (r < 0) {
fprintf(stderr, "Failed to read vCard\n");
return -1;
}
data[r+1] = '\0';

vcardcomponent *card = vcardparser_parse_string(data);
free(data);
Expand Down

0 comments on commit 0693130

Please sign in to comment.