Browse Source

strcat in longpoll thread can write outside of longpoll_block so cat them all in main().

nfactor-troky
Con Kolivas 14 years ago
parent
commit
bb4deaa245
  1. 17
      main.c

17
main.c

@ -879,12 +879,6 @@ static void *stage_thread(void *userdata)
{ {
struct thr_info *mythr = userdata; struct thr_info *mythr = userdata;
bool ok = true; bool ok = true;
unsigned int i;
for (i = 0; i < 36; i++) {
strcat(current_block, "0");
strcat(blank, "0");
}
while (ok) { while (ok) {
struct work *work = NULL; struct work *work = NULL;
@ -1617,7 +1611,6 @@ static void *longpoll_thread(void *userdata)
char *copy_start, *hdr_path, *lp_url = NULL; char *copy_start, *hdr_path, *lp_url = NULL;
bool need_slash = false; bool need_slash = false;
int failures = 0; int failures = 0;
unsigned int i;
hdr_path = tq_pop(mythr->q, NULL); hdr_path = tq_pop(mythr->q, NULL);
if (!hdr_path) if (!hdr_path)
@ -1650,9 +1643,6 @@ static void *longpoll_thread(void *userdata)
goto out; goto out;
} }
for (i = 0; i < 36; i++)
strcat(longpoll_block, "0");
while (1) { while (1) {
json_t *val; json_t *val;
@ -1748,6 +1738,13 @@ int main (int argc, char *argv[])
if (unlikely(pthread_mutex_init(&curses_lock, NULL))) if (unlikely(pthread_mutex_init(&curses_lock, NULL)))
return 1; return 1;
for (i = 0; i < 36; i++) {
strcat(blank, "0");
strcat(current_block, "0");
strcat(longpoll_block, "0");
}
#ifdef WIN32 #ifdef WIN32
opt_n_threads = num_processors = 1; opt_n_threads = num_processors = 1;
#else #else

Loading…
Cancel
Save