Commit bc5480220c1890985c135b0f1758994206800595

Con Kolivas 2014-04-03T12:31:13

Json escape any strings written to the config file

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
diff --git a/cgminer.c b/cgminer.c
index c803f9c..3ffdbbe 100644
--- a/cgminer.c
+++ b/cgminer.c
@@ -4962,10 +4962,10 @@ void write_config(FILE *fcfg)
 			if (opt->type & OPT_HASARG &&
 			    ((void *)opt->cb_arg == (void *)opt_set_charp) &&
 			    opt->desc != opt_hidden) {
-				const char *carg = *(char **)opt->u.arg;
+				char *carg = *(char **)opt->u.arg;
 
 				if (carg)
-					fprintf(fcfg, ",\n\"%s\" : \"%s\"", p+2, carg);
+					fprintf(fcfg, ",\n\"%s\" : \"%s\"", p+2, json_escape(carg));
 			}
 		}
 		free(name);