summary |
shortlog |
log |
commit | commitdiff |
tree
raw |
patch |
inline | side by side (from parent 1:
b5bf417)
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
+ /*
+ * Using strlen on *buf instead of size of open_memstream
+ * because its size includes garbage at the end (after final
+ * \0). This is the allocated size, not the actual string size.
+ */
out = open_memstream(buf, &size);
if (out == NULL)
return -errno;
out = open_memstream(buf, &size);
if (out == NULL)
return -errno;
fclose(out); /* flush the buffer */
fclose(in);
/* open for reading */
fclose(out); /* flush the buffer */
fclose(in);
/* open for reading */
- *fp = fmemopen(*buf, size, "rb");
+ *fp = fmemopen(*buf, strlen(*buf), "rb");