mwatts@redhat.com has uploaded this change for review.

View Change

CONFIG/RGW fix open_memstream use auto after stack pop

The routine open_memstream creates a string buffer that can be accessed
by other stdio calls. The Gnu libc version documents that fclose on
a descriptor created by this routine will update the "streambuf" and
"streamsz" variables that were passed to open_memstream. But the stack
frame in cu_rados_url_fetch which contained these variables is long gone,
so this wins up being a reference to memory that is likely outside the
current stack, but might be used by some other unsuspecting routine
now or in the future.

The changes here make it possible for url_fetch to return a callback that
will later be used to release any storage associated when the stream
when it is no longer needed. And the logic in conf_url_rados has been
modified to take advantage of that to keep streambuf and streamsz in
valid memory until after fclose.

Change-Id: Ia419acbd8fa0e518f39438f1c5e34edd4ec5bf56
Signed-off-by: Marcus Watts <mwatts@redhat.com>
---
M src/config_parsing/conf_lex.l
M src/config_parsing/conf_url.c
M src/config_parsing/conf_url_rados.c
M src/include/conf_url.h
4 files changed, 40 insertions(+), 22 deletions(-)

git pull ssh://review.gerrithub.io:29418/ffilz/nfs-ganesha refs/changes/50/1235150/1

To view, visit change 1235150. To unsubscribe, or for help writing mail filters, visit settings.

Gerrit-MessageType: newchange
Gerrit-Project: ffilz/nfs-ganesha
Gerrit-Branch: next
Gerrit-Change-Id: Ia419acbd8fa0e518f39438f1c5e34edd4ec5bf56
Gerrit-Change-Number: 1235150
Gerrit-PatchSet: 1
Gerrit-Owner: mwatts@redhat.com