Skip to content

Commit 968ca92

Browse files
committed
make sure strings are null terminated.
1 parent a9ce779 commit 968ca92

1 file changed

Lines changed: 1 addition & 1 deletion

File tree

src/napi5.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ static herr_t readStringAttribute(hid_t attr, char **data)
135135
}
136136

137137
iRet = H5Aread(attr, atype, strings[0]);
138-
*data = malloc((sdim + 2) * thedims[0] * sizeof(char));
138+
*data = calloc((sdim + 2) * thedims[0], sizeof(char));
139139
for(i=0; i<thedims[0]; i++) {
140140
if (i==0) {
141141
strncpy(*data, strings[i], sdim);

0 commit comments

Comments
 (0)