tuntox icon indicating copy to clipboard operation
tuntox copied to clipboard

Fix coverity errors

Open gjedeer opened this issue 5 years ago • 0 comments

Subject: New Defects reported by Coverity Scan for gjedeer/tuntox
Date: Sat, 17 Nov 2018 11:40:52 +0000 (UTC)

Hi,

Please find the latest report on new defect(s) introduced to gjedeer/tuntox found with Coverity Scan.

3 new defect(s) introduced to gjedeer/tuntox found with Coverity Scan.


New defect(s) Reported-by: Coverity Scan
Showing 3 of 3 defect(s)


** CID 184347:  Uninitialized variables  (MISSING_RETURN)
/client.c: 262 in client_close_tunnel()


________________________________________________________________________________________________________
*** CID 184347:  Uninitialized variables  (MISSING_RETURN)
/client.c: 262 in client_close_tunnel()
256         if(tun->sockfd)
257         {
258             FD_CLR(tun->sockfd, &client_master_fdset);
259         }
260     
261         tunnel_delete(tun);
>>>     CID 184347:  Uninitialized variables  (MISSING_RETURN)
>>>     Arriving at the end of a function without returning a value.  
262     }
263     
264     /* Close and delete all tunnels (when server went offline) */
265     int client_close_all_connections()
266     {
267     	tunnel *tmp = NULL;

** CID 184346:  Control flow issues  (MISSING_BREAK)
/client.c: 662 in do_client_loop()


________________________________________________________________________________________________________
*** CID 184346:  Control flow issues  (MISSING_BREAK)
/client.c: 662 in do_client_loop()
656     						{
657     							state = CLIENT_STATE_FORWARDING;
658     						}
659     					}
660     				}
661     				break;
>>>     CID 184346:  Control flow issues  (MISSING_BREAK)
>>>     The case for value "-1" is not terminated by a 'break' statement.  
662     			case 0xffffffff:
663     				log_printf(L_ERROR, "You forgot a break statement\n");
664                 case CLIENT_STATE_SHUTDOWN:
665                     exit(0);
666                     break;
667             }
668     
669             usleep(tox_iteration_interval(tox) * 1000);
670         }

** CID 184345:  Uninitialized variables  (MISSING_RETURN)
/client.c: 274 in client_close_all_connections()


________________________________________________________________________________________________________
*** CID 184345:  Uninitialized variables  (MISSING_RETURN)
/client.c: 274 in client_close_all_connections()
268     	tunnel *tun = NULL;
269     
270     	HASH_ITER(hh, by_id, tun, tmp)
271     	{
272     		client_close_tunnel(tun);
273     	}
>>>     CID 184345:  Uninitialized variables  (MISSING_RETURN)
>>>     Arriving at the end of a function without returning a value.  
274     }
275     
276     /* Main loop for the client */
277     int do_client_loop(uint8_t *tox_id_str)
278     {
279         unsigned char tox_packet_buf[PROTOCOL_MAX_PACKET_SIZE];



gjedeer avatar Nov 17 '18 15:11 gjedeer