Skip to content

Commit 2efb81d

Browse files
committed
main BUGFIX invalid memory access on rpc
Fixes #1695
1 parent 40de43a commit 2efb81d

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,8 +54,8 @@ set(LIBNETCONF2_DEP_SOVERSION 4.5.1)
5454
set(LIBNETCONF2_DEP_SOVERSION_MAJOR 4)
5555

5656
# sysrepo required version
57-
set(SYSREPO_DEP_VERSION 3.4.3)
58-
set(SYSREPO_DEP_SOVERSION 7.30.0)
57+
set(SYSREPO_DEP_VERSION 3.4.8)
58+
set(SYSREPO_DEP_SOVERSION 7.30.5)
5959
set(SYSREPO_DEP_SOVERSION_MAJOR 7)
6060

6161
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wall -Wextra -std=c99")

src/main.c

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -310,9 +310,13 @@ np2srv_rpc_cb(struct lyd_node *rpc, struct nc_session *ncs)
310310

311311
/* error reply */
312312
reply = np_reply_err_sr(user_sess->sess, LYD_NAME(rpc));
313+
} else if (output) {
314+
/* data reply */
315+
reply = np_reply_success(rpc, output->tree);
316+
output->tree = NULL;
313317
} else {
314-
/* OK/data reply */
315-
reply = np_reply_success(rpc, output ? output->tree : NULL);
318+
/* OK reply */
319+
reply = np_reply_success(rpc, NULL);
316320
}
317321
}
318322

0 commit comments

Comments
 (0)