Description: Fix arithmetic precedence for consecutive ADDOP or MULOP
Author: Gilles Filippini <pini@debian.org>
Bug-Debian: https://bugs.debian.org/862221
Last-Updated: 2021-09-29

--- a/exp.c
+++ b/exp.c
@@ -259,10 +259,10 @@
     int i = 0;
 
     p1 = exp5(vp, ignore);
-    if (isa(**vp, ADDOP)) {
+    while (isa(**vp, ADDOP)) {
 	Char *op = *(*vp)++;
 
-	p2 = exp4(vp, ignore);
+	p2 = exp5(vp, ignore);
 	if (!(ignore & IGNORE))
 	    switch (op[0]) {
 
@@ -276,7 +276,7 @@
 	    }
 	free(p1);
 	free(p2);
-	return (putn(i));
+	p1 = putn(i);
     }
     return (p1);
 }
@@ -288,10 +288,10 @@
     int i = 0, l;
 
     p1 = exp6(vp, ignore);
-    if (isa(**vp, MULOP)) {
+    while (isa(**vp, MULOP)) {
 	Char *op = *(*vp)++;
 
-	p2 = exp5(vp, ignore);
+	p2 = exp6(vp, ignore);
 	if (!(ignore & IGNORE))
 	    switch (op[0]) {
 
@@ -323,7 +323,7 @@
 	    }
 	free(p1);
 	free(p2);
-	return (putn(i));
+	p1 = putn(i);
     }
     return (p1);
 }
