[network-manager-openvpn] utils: fix failure return value for nmovpn_remote_parse()



commit 350196b1f7652c241c00e75075e6120cd9df5360
Author: Thomas Haller <thaller redhat com>
Date:   Mon Jan 8 20:11:51 2018 +0100

    utils: fix failure return value for nmovpn_remote_parse()
    
    Fixes: 3c5c7efba75ffd121be3b0ac179c36ca9aa772b0
    
    https://bugzilla.gnome.org/show_bug.cgi?id=792252

 shared/utils.c |    8 ++++----
 1 files changed, 4 insertions(+), 4 deletions(-)
---
diff --git a/shared/utils.c b/shared/utils.c
index aa2565e..58d9089 100644
--- a/shared/utils.c
+++ b/shared/utils.c
@@ -116,7 +116,7 @@ _is_inet6_addr (const char *str, gboolean with_square_brackets)
  * nmovpn_remote_parse:
  * @str: the input string to be split. It is modified inplace.
  * @out_buf: an allocated string, to which the other arguments
- *   point to. Must be freeded by caller.
+ *   point to. Must be freed by caller.
  * @out_host: pointer to the host out argument.
  * @out_port: pointer to the port out argument.
  * @out_proto: pointer to the proto out argument.
@@ -192,7 +192,7 @@ nmovpn_remote_parse (const char *str,
        if (!host[0]) {
                g_set_error (error, NM_UTILS_ERROR, NM_UTILS_ERROR_UNKNOWN,
                             _("empty host"));
-               idx_fail = host - str;
+               idx_fail = host - str_copy;
                goto out_fail;
        }
        if (port) {
@@ -202,7 +202,7 @@ nmovpn_remote_parse (const char *str,
                } else if (_nm_utils_ascii_str_to_int64 (port, 10, 1, 0xFFFF, 0) == 0) {
                        g_set_error (error, NM_UTILS_ERROR, NM_UTILS_ERROR_UNKNOWN,
                                     _("invalid port"));
-                       idx_fail = port - str;
+                       idx_fail = port - str_copy;
                        goto out_fail;
                }
        }
@@ -213,7 +213,7 @@ nmovpn_remote_parse (const char *str,
                } else if (!NM_IN_STRSET (proto, NMOVPN_PROTCOL_TYPES)) {
                        g_set_error (error, NM_UTILS_ERROR, NM_UTILS_ERROR_UNKNOWN,
                                     _("invalid protocol"));
-                       idx_fail = proto - str;
+                       idx_fail = proto - str_copy;
                        goto out_fail;
                }
        }


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]