mirror of
https://github.com/shadowsocks/shadowsocks-libev.git
synced 2026-10-27 19:23:40 +00:00
Fix Build Fail with GCC8
This commit is contained in:
+5
-5
@@ -288,13 +288,13 @@ get_server(char *buf, int len)
|
||||
json_value *value = obj->u.object.values[i].value;
|
||||
if (strcmp(name, "server_port") == 0) {
|
||||
if (value->type == json_string) {
|
||||
strncpy(server->port, value->u.string.ptr, 8);
|
||||
strncpy(server->port, value->u.string.ptr, 7);
|
||||
} else if (value->type == json_integer) {
|
||||
snprintf(server->port, 8, "%" PRIu64 "", value->u.integer);
|
||||
}
|
||||
} else if (strcmp(name, "password") == 0) {
|
||||
if (value->type == json_string) {
|
||||
strncpy(server->password, value->u.string.ptr, 128);
|
||||
strncpy(server->password, value->u.string.ptr, 127);
|
||||
}
|
||||
} else if (strcmp(name, "method") == 0) {
|
||||
if (value->type == json_string) {
|
||||
@@ -355,7 +355,7 @@ parse_traffic(char *buf, int len, char *port, uint64_t *traffic)
|
||||
char *name = obj->u.object.values[i].name;
|
||||
json_value *value = obj->u.object.values[i].value;
|
||||
if (value->type == json_integer) {
|
||||
strncpy(port, name, 8);
|
||||
strncpy(port, name, 7);
|
||||
*traffic = value->u.integer;
|
||||
}
|
||||
}
|
||||
@@ -1172,8 +1172,8 @@ main(int argc, char **argv)
|
||||
for (i = 0; i < conf->port_password_num; i++) {
|
||||
struct server *server = ss_malloc(sizeof(struct server));
|
||||
memset(server, 0, sizeof(struct server));
|
||||
strncpy(server->port, conf->port_password[i].port, 8);
|
||||
strncpy(server->password, conf->port_password[i].password, 128);
|
||||
strncpy(server->port, conf->port_password[i].port, 7);
|
||||
strncpy(server->password, conf->port_password[i].password, 127);
|
||||
add_server(&manager, server);
|
||||
}
|
||||
}
|
||||
|
||||
+1
-1
@@ -81,7 +81,7 @@ setinterface(int socket_fd, const char *interface_name)
|
||||
{
|
||||
struct ifreq interface;
|
||||
memset(&interface, 0, sizeof(struct ifreq));
|
||||
strncpy(interface.ifr_name, interface_name, IFNAMSIZ);
|
||||
strncpy(interface.ifr_name, interface_name, IFNAMSIZ-1);
|
||||
int res = setsockopt(socket_fd, SOL_SOCKET, SO_BINDTODEVICE, &interface,
|
||||
sizeof(struct ifreq));
|
||||
return res;
|
||||
|
||||
+1
-1
@@ -813,7 +813,7 @@ server_recv_cb(EV_P_ ev_io *w, int revents)
|
||||
int offset = 0;
|
||||
int need_query = 0;
|
||||
char atyp = server->buf->data[offset++];
|
||||
char host[257] = { 0 };
|
||||
char host[255] = { 0 };
|
||||
uint16_t port = 0;
|
||||
struct addrinfo info;
|
||||
struct sockaddr_storage storage;
|
||||
|
||||
Reference in New Issue
Block a user