From 3df42ca949a8cd98c956e2ff127ee2a5d8ee8fef Mon Sep 17 00:00:00 2001 From: Daniel Stenberg Date: Sun, 17 May 2020 19:47:45 +0200 Subject: dynbuf: return NULL when there's no buffer length ... as returning a "" is not a good idea as the string is supposed to be allocated and returning a const string will cause issues. Reported-by: Brian Carpenter Follow-up to ed35d6590e72c Closes #5405 --- docs/DYNBUF.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'docs') diff --git a/docs/DYNBUF.md b/docs/DYNBUF.md index 3ab059bae..550477ee1 100644 --- a/docs/DYNBUF.md +++ b/docs/DYNBUF.md @@ -60,17 +60,17 @@ larger than the buffer length. char *Curl_dyn_ptr(const struct dynbuf *s); -Returns a `char *` to the buffer. Since the buffer may be reallocated, this -pointer should not be trusted or used anymore after the next buffer -manipulation call. +Returns a `char *` to the buffer if it has a length, otherwise a NULL. Since +the buffer may be reallocated, this pointer should not be trusted or used +anymore after the next buffer manipulation call. ## uptr unsigned char *Curl_dyn_uptr(const struct dynbuf *s); -Returns an `unsigned char *` to the buffer. Since the buffer may be -reallocated, this pointer should not be trusted or used anymore after the next -buffer manipulation call. +Returns an `unsigned char *` to the buffer if it has a length, otherwise a +NULL. Since the buffer may be reallocated, this pointer should not be trusted +or used anymore after the next buffer manipulation call. ## len -- cgit v1.2.3