mirror of
https://github.com/openstreetmap/mod_tile.git
synced 2025-08-08 08:24:25 +00:00
Fix issues found via coverity scan
This commit is contained in:
@ -189,6 +189,7 @@ static void parameterize_map_max_connections(Map &m, int num_threads) {
|
||||
#endif
|
||||
l.set_datasource(ds);
|
||||
}
|
||||
free(tmp);
|
||||
}
|
||||
|
||||
|
||||
|
@ -8,6 +8,10 @@
|
||||
int send_cmd(struct protocol * cmd, int fd) {
|
||||
int ret;
|
||||
syslog(LOG_DEBUG, "DEBUG: Sending render cmd with protocol version %i\n", cmd->ver);
|
||||
if ((cmd->ver > 3) || (cmd->ver < 1)) {
|
||||
syslog(LOG_WARNING, "WARNING: Failed to send render cmd with unknown protocol version %i\n", cmd->ver);
|
||||
return -1;
|
||||
}
|
||||
switch (cmd->ver) {
|
||||
case 1:
|
||||
ret = send(fd, cmd, sizeof(struct protocol_v1), 0);
|
||||
@ -34,15 +38,22 @@ int recv_cmd(struct protocol * cmd, int fd) {
|
||||
} else if (ret < sizeof(struct protocol_v1)) {
|
||||
return 0;
|
||||
}
|
||||
if ((cmd->ver > 3) || (cmd->ver < 1)) {
|
||||
syslog(LOG_WARNING, "WARNING: Failed to recieve render cmd with unknown protocol version %i\n", cmd->ver);
|
||||
return -1;
|
||||
}
|
||||
syslog(LOG_DEBUG, "DEBUG: Got incoming request with protocol version %i\n", cmd->ver);
|
||||
switch (cmd->ver) {
|
||||
switch (cmd->ver) {
|
||||
case 1:
|
||||
ret2 = 0;
|
||||
break;
|
||||
case 2: ret2 = recv(fd, ((void*)cmd) + sizeof(struct protocol_v1), sizeof(struct protocol_v2) - sizeof(struct protocol_v1), MSG_DONTWAIT);
|
||||
break;
|
||||
case 3: ret2 = recv(fd, ((void*)cmd) + sizeof(struct protocol_v1), sizeof(struct protocol) - sizeof(struct protocol_v1), MSG_DONTWAIT);
|
||||
break;
|
||||
}
|
||||
|
||||
if (ret2 < 1) {
|
||||
if ((cmd->ver > 1) && (ret2 < 1)) {
|
||||
syslog(LOG_WARNING, "WARNING: Socket prematurely closed: %i\n", fd);
|
||||
return -1;
|
||||
}
|
||||
|
Reference in New Issue
Block a user