Skip to content
Browse files

Init empty char[] to prevent segfault.

  • Loading branch information...
1 parent 4acb687 commit bb0feb973a66c08e99cbe374d8d70c177035114a @residuum committed Feb 5, 2012
Showing with 3 additions and 1 deletion.
  1. +1 −1 json-decode.c
  2. +2 −0 libpurest_json.c
View
2 json-decode.c
@@ -31,6 +31,6 @@ void json_decode_list(t_json_decode *x, t_symbol *selector, int argcount, t_atom
atom_string(argvec + i, value, MAX_STRING_SIZE);
strcat(json_string, value);
}
- output_json_string(json_string, x->x_ob.ob_outlet, x->done_outlet);
+ output_json_string(*json_string, x->x_ob.ob_outlet, x->done_outlet);
}
}
View
2 libpurest_json.c
@@ -8,7 +8,9 @@ void lowercase_unicode(char *orig) {
short i;
short uni_len = 4; /*TODO: get real length, we just assume 4 for now */
if (tmp) {
+ memset(orig_return, 0, strlen(orig));
strncpy(orig_return, orig, strlen(orig) - strlen(tmp));
+ post("length old %d, new %d", strlen(orig), strlen(orig_return));
do {
for (i = 2; i < 2 + uni_len; i++) {
switch (tmp[i]) {

0 comments on commit bb0feb9

Please sign in to comment.
Something went wrong with that request. Please try again.