summaryrefslogtreecommitdiff
path: root/ifparser.c
diff options
context:
space:
mode:
authorAdam Jackson <ajax@nwnk.net>2005-12-09 18:27:47 +0000
committerAdam Jackson <ajax@nwnk.net>2005-12-09 18:27:47 +0000
commitcbb537c9276302f56c82c0dd010db400bd605f57 (patch)
treeea0642984ba2a51bb1cedd15ccd8041f30e0ae23 /ifparser.c
parent34c35bcb3851909468c679c2014b6197c7be270e (diff)
Bug #4380: Avoid dividing by zero in gccmakedepend (Vincent Le Ligeour)MODULAR_COPY
Diffstat (limited to 'ifparser.c')
-rw-r--r--ifparser.c6
1 files changed, 5 insertions, 1 deletions
diff --git a/ifparser.c b/ifparser.c
index aa51748..58c05a0 100644
--- a/ifparser.c
+++ b/ifparser.c
@@ -65,6 +65,7 @@
#include <ctype.h>
#include <stdlib.h>
#include <string.h>
+#include <limits.h>
/****************************************************************************
Internal Macros and Utilities for Parser
@@ -296,7 +297,10 @@ parse_product (IfParser *g, const char *cp, long *valp)
case '/':
DO (cp = parse_product (g, cp + 1, &rightval));
- *valp = (*valp / rightval);
+ if (rightval)
+ *valp = (*valp / rightval);
+ else
+ *valp = LONG_MAX;
break;
case '%':