mirror of
https://github.com/curl/curl.git
synced 2026-08-25 10:43:34 +03:00
lib: strndup/memdup instead of malloc, memcpy and null-terminate
- bufref: use strndup - cookie: use strndup - formdata: use strndup - ftp: use strndup - gtls: use aprintf instead of malloc + strcpy * 2 - http: use strndup - mbedtls: use strndup - md4: use memdup - ntlm: use memdup - ntlm_sspi: use strndup - pingpong: use memdup - rtsp: use strndup instead of malloc, memcpy and null-terminate - sectransp: use strndup - socks_gssapi.c: use memdup - vtls: use dynbuf instead of malloc, snprintf and memcpy - vtls: use strdup instead of malloc + memcpy - wolfssh: use strndup Closes #12453
This commit is contained in:
parent
63cdaefbc3
commit
7309b9cbbf
16 changed files with 48 additions and 91 deletions
|
|
@ -35,6 +35,7 @@
|
|||
#include "timeval.h"
|
||||
#include "socks.h"
|
||||
#include "warnless.h"
|
||||
#include "strdup.h"
|
||||
|
||||
/* The last 3 #include files should be in this order */
|
||||
#include "curl_printf.h"
|
||||
|
|
@ -139,10 +140,9 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(struct Curl_cfilter *cf,
|
|||
/* prepare service name */
|
||||
if(strchr(serviceptr, '/')) {
|
||||
service.length = serviceptr_length;
|
||||
service.value = malloc(service.length);
|
||||
service.value = Curl_memdup(serviceptr, service.length);
|
||||
if(!service.value)
|
||||
return CURLE_OUT_OF_MEMORY;
|
||||
memcpy(service.value, serviceptr, service.length);
|
||||
|
||||
gss_major_status = gss_import_name(&gss_minor_status, &service,
|
||||
(gss_OID) GSS_C_NULL_OID, &server);
|
||||
|
|
@ -387,12 +387,11 @@ CURLcode Curl_SOCKS5_gssapi_negotiate(struct Curl_cfilter *cf,
|
|||
}
|
||||
else {
|
||||
gss_send_token.length = 1;
|
||||
gss_send_token.value = malloc(1);
|
||||
gss_send_token.value = Curl_memdup(&gss_enc, 1);
|
||||
if(!gss_send_token.value) {
|
||||
gss_delete_sec_context(&gss_status, &gss_context, NULL);
|
||||
return CURLE_OUT_OF_MEMORY;
|
||||
}
|
||||
memcpy(gss_send_token.value, &gss_enc, 1);
|
||||
|
||||
gss_major_status = gss_wrap(&gss_minor_status, gss_context, 0,
|
||||
GSS_C_QOP_DEFAULT, &gss_send_token,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue