mirror of
https://github.com/curl/curl.git
synced 2026-08-25 21:53:32 +03:00
curl.h: add CURLE_TOO_LARGE
A new error code to be used when an internal field grows too large, like when a dynbuf reaches its maximum. Previously it would return CURLE_OUT_OF_MEMORY for this, which is highly misleading. Ref: #12268 Closes #12269
This commit is contained in:
parent
b7258e4922
commit
f58e493e44
13 changed files with 132 additions and 91 deletions
|
|
@ -81,7 +81,7 @@ static CURLcode dyn_nappend(struct dynbuf *s,
|
|||
|
||||
if(fit > s->toobig) {
|
||||
Curl_dyn_free(s);
|
||||
return CURLE_OUT_OF_MEMORY;
|
||||
return CURLE_TOO_LARGE;
|
||||
}
|
||||
else if(!a) {
|
||||
DEBUGASSERT(!indx);
|
||||
|
|
@ -199,6 +199,9 @@ CURLcode Curl_dyn_vaddf(struct dynbuf *s, const char *fmt, va_list ap)
|
|||
|
||||
if(!rc)
|
||||
return CURLE_OK;
|
||||
else if(rc == MERR_TOO_LARGE)
|
||||
return CURLE_TOO_LARGE;
|
||||
return CURLE_OUT_OF_MEMORY;
|
||||
#else
|
||||
char *str;
|
||||
#ifdef __clang__
|
||||
|
|
@ -217,8 +220,8 @@ CURLcode Curl_dyn_vaddf(struct dynbuf *s, const char *fmt, va_list ap)
|
|||
}
|
||||
/* If we failed, we cleanup the whole buffer and return error */
|
||||
Curl_dyn_free(s);
|
||||
return CURLE_OK;
|
||||
#endif
|
||||
return CURLE_OUT_OF_MEMORY;
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue