Add 1 to malloc'd buffer size for null terminator (#128)

This commit is contained in:
Matt Friede 2021-06-22 17:58:44 -04:00 committed by GitHub
parent 7cfe19fe14
commit 28e9e68f3b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -427,7 +427,7 @@ void create_string_arg(grpc_arg* args, size_t i,
grpc_arg* arg = args+i; grpc_arg* arg = args+i;
arg->type = GRPC_ARG_STRING; arg->type = GRPC_ARG_STRING;
arg->key = translate_arg_key(key); arg->key = translate_arg_key(key);
char* storeValue = malloc(sizeof(char)*strlen(value)); char* storeValue = malloc(sizeof(char)*(strlen(value)+1));
arg->value.string = strcpy(storeValue, value); arg->value.string = strcpy(storeValue, value);
} }