diff options
author | Bram Moolenaar <Bram@vim.org> | 2022-06-30 22:13:59 +0100 |
---|---|---|
committer | Bram Moolenaar <Bram@vim.org> | 2022-06-30 22:13:59 +0100 |
commit | fa4873ccfc10e0f278dc46f39d00136fab059b19 (patch) | |
tree | 55d4275e939188fc973d53bcf19e3d6136e6efe6 /src/netbeans.c | |
parent | cdbfc6dbab1d63aa56af316d6b13e37939e7f7a8 (diff) |
patch 9.0.0013: reproducing memory access errors can be difficultv9.0.0013
Problem: Reproducing memory access errors can be difficult.
Solution: When testing, copy each line to allocated memory, so that valgrind
can detect accessing memory before and/or after it. Fix uncovered
problems.
Diffstat (limited to 'src/netbeans.c')
-rw-r--r-- | src/netbeans.c | 8 |
1 files changed, 5 insertions, 3 deletions
diff --git a/src/netbeans.c b/src/netbeans.c index b69a3cb539..5c4527948e 100644 --- a/src/netbeans.c +++ b/src/netbeans.c @@ -2741,13 +2741,15 @@ netbeans_inserted( if (nbbuf->insertDone) nbbuf->modified = 1; + // send the "insert" EVT + newtxt = alloc(newlen + 1); + vim_strncpy(newtxt, txt, newlen); + + // Note: this may make "txt" invalid pos.lnum = linenr; pos.col = col; off = pos2off(bufp, &pos); - // send the "insert" EVT - newtxt = alloc(newlen + 1); - vim_strncpy(newtxt, txt, newlen); p = nb_quote(newtxt); if (p != NULL) { |