Do variable length arrays the C99 way
Variable length arrays are supported by C99, but having it denoted as "1" confused the compiler and is not defined. Note that because we don't get the inferred NULL terminator, we have to increase the malloc size by one.
This commit is contained in:
@@ -452,7 +452,7 @@ sudo_ldap_parse_keyword(const char *keyword, const char *value,
|
||||
|
||||
if (len > 0) {
|
||||
head = (struct ldap_config_str_list *)cur->valp;
|
||||
if ((str = malloc(sizeof(*str) + len)) == NULL) {
|
||||
if ((str = malloc(sizeof(*str) + len + 1)) == NULL) {
|
||||
sudo_warnx(U_("%s: %s"), __func__, U_("unable to allocate memory"));
|
||||
debug_return_bool(false);
|
||||
}
|
||||
|
Reference in New Issue
Block a user