Merge pull request #4 from dovecoteescapee/main

Some fixes for android
This commit is contained in:
Human From Earth 2024-03-03 16:58:14 +03:00 committed by GitHub
commit 64a6989f7a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 9 additions and 9 deletions

6
main.c
View File

@ -360,7 +360,7 @@ int main(int argc, char **argv)
case 'l': case 'l':
fake_tls.data = ftob(optarg, &fake_tls.size); fake_tls.data = ftob(optarg, &fake_tls.size);
if (!fake_tls.data) { if (!fake_tls.data) {
perror("read file"); uniperror("read file");
return -1; return -1;
} }
break; break;
@ -368,7 +368,7 @@ int main(int argc, char **argv)
case 'o': case 'o':
fake_http.data = ftob(optarg, &fake_http.size); fake_http.data = ftob(optarg, &fake_http.size);
if (!fake_http.data) { if (!fake_http.data) {
perror("read file"); uniperror("read file");
return -1; return -1;
} }
break; break;
@ -376,7 +376,7 @@ int main(int argc, char **argv)
case 'e': case 'e':
oob_data.data = ftob(optarg, &oob_data.size); oob_data.data = ftob(optarg, &oob_data.size);
if (!oob_data.data) { if (!oob_data.data) {
perror("read file"); uniperror("read file");
return -1; return -1;
} }
break; break;

View File

@ -85,7 +85,7 @@ int find_tls_ext_offset(uint16_t type, char *data, size_t size)
} }
int change_tls_sni(char *host, char *buffer, size_t bsize) int change_tls_sni(const char *host, char *buffer, size_t bsize)
{ {
int sni_offs, pad_offs; int sni_offs, pad_offs;

View File

@ -13,7 +13,7 @@
extern char tls_data[517]; extern char tls_data[517];
extern char http_data[43]; extern char http_data[43];
int change_tls_sni(char *host, char *buffer, size_t bsize); int change_tls_sni(const char *host, char *buffer, size_t bsize);
int parse_tls(char *buffer, size_t bsize, char **hs); int parse_tls(char *buffer, size_t bsize, char **hs);

View File

@ -529,7 +529,7 @@ static inline int on_tunnel(struct poolhd *pool, struct eval *val,
val->size = n - sn; val->size = n - sn;
if (!(val->tmpbuf = malloc(val->size))) { if (!(val->tmpbuf = malloc(val->size))) {
perror("malloc"); uniperror("malloc");
return -1; return -1;
} }
memcpy(val->tmpbuf, buffer + sn, val->size); memcpy(val->tmpbuf, buffer + sn, val->size);
@ -552,19 +552,19 @@ int event_loop(int srvfd)
struct poolhd *pool = init_pool(params.max_open * 2 + 1); struct poolhd *pool = init_pool(params.max_open * 2 + 1);
if (!pool) { if (!pool) {
perror("init pool"); uniperror("init pool");
close(srvfd); close(srvfd);
return -1; return -1;
} }
if (!add_event(pool, EV_ACCEPT, srvfd, 0)) { if (!add_event(pool, EV_ACCEPT, srvfd, 0)) {
perror("add event"); uniperror("add event");
destroy_pool(pool); destroy_pool(pool);
close(srvfd); close(srvfd);
return -1; return -1;
} }
char *buffer = malloc(params.bfsize); char *buffer = malloc(params.bfsize);
if (!buffer) { if (!buffer) {
perror("malloc"); uniperror("malloc");
destroy_pool(pool); destroy_pool(pool);
return -1; return -1;
} }