File: 222_fix_gauge_crash.patch

package info (click to toggle)
newt 0.52.2-10%2Betch1
  • links: PTS
  • area: main
  • in suites: etch
  • size: 836 kB
  • ctags: 27
  • sloc: makefile: 186; sh: 5
file content (26 lines) | stat: -rw-r--r-- 867 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
diff -ur newt-0.52.2/dialogboxes.c newt-0.52.2/dialogboxes.c
--- newt-0.52.2/dialogboxes.c	2005-09-21 05:32:03.000000000 -0400
+++ newt-0.52.2/dialogboxes.c	2006-08-03 01:07:27.000000000 -0400
@@ -140,7 +140,7 @@
 	}
 
 	val = strtoul(buf, &end, 10);
-	if (!*end) {
+	if (!*end && val >= 0) {
 	    newtScaleSet(scale, val);
 	    newtDrawForm(form);
 	    newtRefresh();
diff -ur newt-0.52.2/scale.c newt-0.52.2/scale.c
--- newt-0.52.2/scale.c	2006-08-03 01:07:33.000000000 -0400
+++ newt-0.52.2/scale.c	2006-08-03 01:07:27.000000000 -0400
@@ -48,6 +48,10 @@
     struct scale * sc = co->data;
     int newPercentage;
 
+    /* this will promote fullValue to unsigned for the compare */
+    if (amount > sc->fullValue)
+      amount = sc->fullValue;
+
     sc->charsSet = (amount * co->width) / sc->fullValue;
     newPercentage = (amount * 100) / sc->fullValue;