shithub: neindaw

Download patch

ref: 023f2af0d958b771a8b542009ce359ccf500f3a4
parent: fdd7d0be76013a747dd2c9f3bf73310ffc0f0705
author: Sigrid Haflínudóttir <ftrvxmtrx@gmail.com>
date: Sun Jan 12 13:58:44 EST 2020

uiglue: ctl write: return an error if failed to parse float

--- a/uiglue.c
+++ b/uiglue.c
@@ -61,6 +61,7 @@
 static int
 ui_write(UI *ui, int type, char *s)
 {
+	char *e;
 	int failoor;
 	float v;
 
@@ -80,7 +81,9 @@
 		if (ui->zone != nil)
 			v = *ui->zone - atof(s+3);
 	} else {
-		v = atof(s);
+		v = strtod(s, &e);
+		if (*e != 0 && *e != '\n')
+			return -1;
 		failoor = 1;
 	}