comparison rcg.c @ 15:acf12a2e872d

rcg.c: use snprintf() instead of sprintf()
author paulo@thepaulopc
date Fri, 12 Nov 2010 00:13:48 -0800
parents 669266246c6b
children 74cf5cfa3ec1
comparison
equal deleted inserted replaced
12:5152411bd5af 13:65b7fdf700a0
216 out_len += CLR_STRING_len; 216 out_len += CLR_STRING_len;
217 out = realloc(out, out_len*sizeof(char)); 217 out = realloc(out, out_len*sizeof(char));
218 if (!out) 218 if (!out)
219 exit(realloc_error()); 219 exit(realloc_error());
220 220
221 sprintf(&out[out_pos], "%.*s%s%s%s%.*s%s", so, &buf[buf_pos], CLR_START, clr, CLR_END, match_len, &buf[buf_pos + so], CLR_CLEAR); 221 snprintf(&out[out_pos], out_len, "%.*s%s%s%s%.*s%s", so, &buf[buf_pos], CLR_START, clr, CLR_END, match_len, &buf[buf_pos + so], CLR_CLEAR);
222 222
223 buf_pos += match_len + so; 223 buf_pos += match_len + so;
224 out_pos += CLR_STRING_len + match_len + so; 224 out_pos += CLR_STRING_len + match_len + so;
225 } 225 }
226 else 226 else