mirror of
https://github.com/curl/curl.git
synced 2024-11-21 01:16:58 +08:00
dynbuf: assert for NULL pointer inputs
Help us catch more mistakes. Closes #12238
This commit is contained in:
parent
5f78cf503c
commit
27f2352d49
@ -77,6 +77,7 @@ static CURLcode dyn_nappend(struct dynbuf *s,
|
||||
DEBUGASSERT(indx < s->toobig);
|
||||
DEBUGASSERT(!s->leng || s->bufr);
|
||||
DEBUGASSERT(a <= s->toobig);
|
||||
DEBUGASSERT(!len || mem);
|
||||
|
||||
if(fit > s->toobig) {
|
||||
Curl_dyn_free(s);
|
||||
@ -174,10 +175,12 @@ CURLcode Curl_dyn_addn(struct dynbuf *s, const void *mem, size_t len)
|
||||
*/
|
||||
CURLcode Curl_dyn_add(struct dynbuf *s, const char *str)
|
||||
{
|
||||
size_t n = strlen(str);
|
||||
size_t n;
|
||||
DEBUGASSERT(str);
|
||||
DEBUGASSERT(s);
|
||||
DEBUGASSERT(s->init == DYNINIT);
|
||||
DEBUGASSERT(!s->leng || s->bufr);
|
||||
n = strlen(str);
|
||||
return dyn_nappend(s, (unsigned char *)str, n);
|
||||
}
|
||||
|
||||
@ -191,6 +194,7 @@ CURLcode Curl_dyn_vaddf(struct dynbuf *s, const char *fmt, va_list ap)
|
||||
DEBUGASSERT(s);
|
||||
DEBUGASSERT(s->init == DYNINIT);
|
||||
DEBUGASSERT(!s->leng || s->bufr);
|
||||
DEBUGASSERT(fmt);
|
||||
rc = Curl_dyn_vprintf(s, fmt, ap);
|
||||
|
||||
if(!rc)
|
||||
|
Loading…
Reference in New Issue
Block a user