aboutsummaryrefslogtreecommitdiff
path: root/contrib
diff options
context:
space:
mode:
authorDimitry Andric <dim@FreeBSD.org>2013-02-16 12:48:06 +0000
committerDimitry Andric <dim@FreeBSD.org>2013-02-16 12:48:06 +0000
commitd21f31a1a7d27d47ce29ad7b365614bc0140b686 (patch)
tree21f86eba20b9d0d899cbf595a5e23ee498a2cfd4 /contrib
parenta9fb907e0b8a8e3d678864b002d783b8c44c7b1e (diff)
downloadsrc-d21f31a1a7d27d47ce29ad7b365614bc0140b686.tar.gz
src-d21f31a1a7d27d47ce29ad7b365614bc0140b686.zip
Fix two instances of undefined behaviour in contrib/nvi.
Found by: clang ToT Obtained from: NetBSD Reviewed by: jh MFC after: 3 days
Notes
Notes: svn path=/head/; revision=246874
Diffstat (limited to 'contrib')
-rw-r--r--contrib/nvi/ex/ex_txt.c4
-rw-r--r--contrib/nvi/vi/v_txt.c6
2 files changed, 6 insertions, 4 deletions
diff --git a/contrib/nvi/ex/ex_txt.c b/contrib/nvi/ex/ex_txt.c
index 2f62ff51a47c..30bcf977f3f0 100644
--- a/contrib/nvi/ex/ex_txt.c
+++ b/contrib/nvi/ex/ex_txt.c
@@ -398,8 +398,8 @@ txt_dent(sp, tp)
++scno;
/* Get the previous shiftwidth column. */
- cno = scno;
- scno -= --scno % sw;
+ cno = scno--;
+ scno -= scno % sw;
/*
* Since we don't know what comes before the character(s) being
diff --git a/contrib/nvi/vi/v_txt.c b/contrib/nvi/vi/v_txt.c
index 4a3e80a181d6..0cb1ff5a89a7 100644
--- a/contrib/nvi/vi/v_txt.c
+++ b/contrib/nvi/vi/v_txt.c
@@ -1956,8 +1956,10 @@ txt_dent(sp, tp, isindent)
target = current;
if (isindent)
target += COL_OFF(target, sw);
- else
- target -= --target % sw;
+ else {
+ --target;
+ target -= target % sw;
+ }
/*
* The AI characters will be turned into overwrite characters if the