Reported by Andreas Dilger <adilger@whamcloud.com>.
* lib/areadlink-with-size.c (areadlink_with_size): Shrink the buffer
before returning it.
+2019-07-05 Bruno Haible <bruno@clisp.org>
+
+ areadlink-with-size: Don't return an excessive memory allocation.
+ Reported by Andreas Dilger <adilger@whamcloud.com>.
+ * lib/areadlink-with-size.c (areadlink_with_size): Shrink the buffer
+ before returning it.
+
2019-07-03 Bruno Haible <bruno@clisp.org>
renameatu: Fix test failure on MSVC.
if (link_length < buf_size)
{
buffer[link_length] = 0;
+ /* Shrink BUFFER before returning it. */
+ if (link_length + 1 < buf_size)
+ {
+ char *shrinked_buffer = realloc (buffer, link_length + 1);
+ if (shrinked_buffer != NULL)
+ buffer = shrinked_buffer;
+ }
return buffer;
}