Fix SEGV on 404
authorDavid Woodhouse <David.Woodhouse@intel.com>
Sun, 4 Apr 2010 18:52:19 +0000 (19:52 +0100)
committerDavid Woodhouse <David.Woodhouse@intel.com>
Sun, 4 Apr 2010 18:52:19 +0000 (19:52 +0100)
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
http.c

diff --git a/http.c b/http.c
index 535fc2b..f660e20 100644 (file)
--- a/http.c
+++ b/http.c
@@ -716,7 +716,12 @@ int openconnect_obtain_cookie(struct openconnect_info *vpninfo)
                        goto retry;
                }
        }
-
+       if (!form_buf || result != 200) {
+               vpninfo->progress(vpninfo, PRG_ERR,
+                                 "Unexpected %d result from server\n",
+                                 result);
+               return -EINVAL;
+       }
        if (vpninfo->csd_stuburl) {
                /* This is the CSD stub script, which we now need to run */
                result = run_csd_script(vpninfo, form_buf, buflen);