mirror of
https://gitlab.freedesktop.org/NetworkManager/NetworkManager
synced 2024-10-07 08:40:59 +00:00
libnm-core: fix coverity warning
3. NetworkManager-1.14.0/libnm-core/nm-utils.c:4944: var_compare_op: Comparing "str" to null implies that "str" might be null. 4. NetworkManager-1.14.0/libnm-core/nm-utils.c:4958: var_deref_op: Dereferencing null pointer "str". # 4956| # 4957| /* do some very basic validation to see if this might be a JSON object. */ # 4958|-> if (str[0] == '{') { # 4959| gsize l; # 4960|
This commit is contained in:
parent
4791782f46
commit
9b04b871a0
|
@ -5002,18 +5002,18 @@ const char **nm_utils_enum_get_values (GType type, int from, int to)
|
|||
static gboolean
|
||||
_nm_utils_is_json_object_no_validation (const char *str, GError **error)
|
||||
{
|
||||
if (str) {
|
||||
/* libjansson also requires only utf-8 encoding. */
|
||||
if (!g_utf8_validate (str, -1, NULL)) {
|
||||
g_set_error_literal (error,
|
||||
NM_CONNECTION_ERROR,
|
||||
NM_CONNECTION_ERROR_INVALID_PROPERTY,
|
||||
_("not valid utf-8"));
|
||||
return FALSE;
|
||||
}
|
||||
while (g_ascii_isspace (str[0]))
|
||||
str++;
|
||||
nm_assert (str);
|
||||
|
||||
/* libjansson also requires only utf-8 encoding. */
|
||||
if (!g_utf8_validate (str, -1, NULL)) {
|
||||
g_set_error_literal (error,
|
||||
NM_CONNECTION_ERROR,
|
||||
NM_CONNECTION_ERROR_INVALID_PROPERTY,
|
||||
_("not valid utf-8"));
|
||||
return FALSE;
|
||||
}
|
||||
while (g_ascii_isspace (str[0]))
|
||||
str++;
|
||||
|
||||
/* do some very basic validation to see if this might be a JSON object. */
|
||||
if (str[0] == '{') {
|
||||
|
|
Loading…
Reference in a new issue