Blob Blame History Raw
From 309b839354b171cd03955537102ca73bc14b7f58 Mon Sep 17 00:00:00 2001
From: Matej Habrnal <mhabrnal@redhat.com>
Date: Mon, 16 May 2016 14:19:34 +0200
Subject: [PATCH] Check the return value of sr_parse_char_cspan

Related to: #1336390

Signed-off-by: Matej Habrnal <mhabrnal@redhat.com>
---
 lib/python_stacktrace.c | 12 +++++++++---
 1 file changed, 9 insertions(+), 3 deletions(-)

diff --git a/lib/python_stacktrace.c b/lib/python_stacktrace.c
index 99aa52c..557b728 100644
--- a/lib/python_stacktrace.c
+++ b/lib/python_stacktrace.c
@@ -231,9 +231,15 @@ sr_python_stacktrace_parse(const char **input,
     }
 
     /* Parse exception name. */
-    sr_parse_char_cspan(&local_input,
-                        ":\n",
-                        &stacktrace->exception_name);
+    if (!sr_parse_char_cspan(&local_input, ":\n", &stacktrace->exception_name))
+    {
+
+        location->message = "Unable to find the ':\\n' characters "
+                            "identifying the end of exception name.";
+        sr_python_stacktrace_free(stacktrace);
+        return NULL;
+
+    }
 
     *input = local_input;
     return stacktrace;
-- 
1.8.3.1