1
0
mirror of https://github.com/rofl0r/proxychains-ng synced 2026-05-17 03:02:41 +08:00

fix segfault in DNS mapping lookup code

the allocatorthread got pointers to RAM which were reallocated
behind the back, and if realloc() couldn't grow in-place, lead
to segfaults in applications that do a lot of DNS-lookups such
as webbrowsers.

closes #66
closes #31

thanks to @ravomavain for tracking down the issue.
This commit is contained in:
rofl0r
2015-06-06 11:41:36 +01:00
Unverified
parent 53c6c2ca9b
commit 2182eff358
8 changed files with 8 additions and 103 deletions
+6 -2
View File
@@ -10,12 +10,10 @@
#include <stddef.h>
#include <errno.h>
#include "allocator_thread.h"
#include "shm.h"
#include "debug.h"
#include "ip_type.h"
#include "mutex.h"
#include "hash.h"
#include "stringdump.h"
/* stuff for our internal translation table */
@@ -30,6 +28,12 @@ typedef struct {
string_hash_tuple** list;
} internal_ip_lookup_table;
static void *dumpstring(char* s, size_t len) {
char* p = malloc(len);
if(p) memcpy(p, s, len);
return p;
}
pthread_mutex_t internal_ips_lock;
internal_ip_lookup_table *internal_ips = NULL;
internal_ip_lookup_table internal_ips_buf;