mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager.git
synced 2025-12-20 16:20:05 +01:00
supplicant: separate input and local value
We reallocate this value in the function, which is necessary because we write into it, and the input is const. Move the allocation into a local variable instead of overwriting the input pointer, because we are also pointing to it via `char* s`, which is not const.
This commit is contained in:
parent
5f6beb0e57
commit
754b87e1c4
1 changed files with 4 additions and 3 deletions
|
|
@ -212,18 +212,19 @@ validate_type_utf8(const struct Opt *opt, const char *value, const guint32 len)
|
||||||
}
|
}
|
||||||
|
|
||||||
static gboolean
|
static gboolean
|
||||||
validate_type_keyword(const struct Opt *opt, const char *value, const guint32 len)
|
validate_type_keyword(const struct Opt *opt, const char *value_in, const guint32 len)
|
||||||
{
|
{
|
||||||
gs_free char *value_free = NULL;
|
gs_free char *value_free = NULL;
|
||||||
|
char *value;
|
||||||
|
|
||||||
nm_assert(opt);
|
nm_assert(opt);
|
||||||
nm_assert(value);
|
nm_assert(value_in);
|
||||||
|
|
||||||
/* Allow everything */
|
/* Allow everything */
|
||||||
if (!opt->str_allowed)
|
if (!opt->str_allowed)
|
||||||
return TRUE;
|
return TRUE;
|
||||||
|
|
||||||
value = nm_strndup_a(300, value, len, &value_free);
|
value = nm_strndup_a(300, value_in, len, &value_free);
|
||||||
|
|
||||||
/* validate each space-separated word in 'value' */
|
/* validate each space-separated word in 'value' */
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue