diff options
author | Beniamino Galvani <bgalvani@redhat.com> | 2018-10-07 14:01:08 +0200 |
---|---|---|
committer | Beniamino Galvani <bgalvani@redhat.com> | 2018-10-07 14:01:08 +0200 |
commit | 0cb5c4f61190d43eccee0a68878bf1921fd40b77 (patch) | |
tree | d791dcf0fbed5d415c4133bd9b3cd3af03f44120 /libnm-core/nm-utils.c | |
parent | 4791782f4662ef93179fa183918bedaf49a64d97 (diff) | |
parent | 72b45417712186b0247ba5a69e42d54a27763fb0 (diff) | |
download | NetworkManager-0cb5c4f61190d43eccee0a68878bf1921fd40b77.tar.gz |
merge: branch 'bg/covscan'
Some coverity fixes.
https://github.com/NetworkManager/NetworkManager/pull/220
Diffstat (limited to 'libnm-core/nm-utils.c')
-rw-r--r-- | libnm-core/nm-utils.c | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/libnm-core/nm-utils.c b/libnm-core/nm-utils.c index 724c1a6c24..eca16a138e 100644 --- a/libnm-core/nm-utils.c +++ b/libnm-core/nm-utils.c @@ -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] == '{') { |