From 2f997b169a6de6eee968e6cd795f308ce536f552 Mon Sep 17 00:00:00 2001 From: Vladimir Ratnikov Date: Thu, 25 Apr 2019 06:20:15 -0400 Subject: [PATCH] Add yang_stmt NULL check in yang_order to prevent SEGFAULT --- lib/src/clixon_yang.c | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/src/clixon_yang.c b/lib/src/clixon_yang.c index 25722f11..4f58c9fd 100644 --- a/lib/src/clixon_yang.c +++ b/lib/src/clixon_yang.c @@ -850,6 +850,10 @@ yang_order(yang_stmt *y) * if so, the real parent (from an xml point of view) is the parents * parent. */ + if (y == NULL){ + return -1; + } + yp = y->ys_parent; while (yp->ys_keyword == Y_CASE || yp->ys_keyword == Y_CHOICE) yp = yp->ys_parent;