Fix strncpy() compilation warnings
Fix strncpy() compilation warnings wherein the target string length did not account for a nul terminator
This commit is contained in:
		
							parent
							
								
									58d9a37786
								
							
						
					
					
						commit
						00879d33c5
					
				
					 3 changed files with 3 additions and 3 deletions
				
			
		|  | @ -92,7 +92,7 @@ int main(int argc, char **argv) { | ||||||
|             goto error_client_socket; |             goto error_client_socket; | ||||||
|         } |         } | ||||||
| 
 | 
 | ||||||
|         strncpy(ifreq.name, ifname, sizeof(ifreq.name)); |         strncpy(ifreq.name, ifname, sizeof(ifreq.name)-1); | ||||||
| 
 | 
 | ||||||
|         ifreq.state = PATTY_AX25_SOCK_PROMISC; |         ifreq.state = PATTY_AX25_SOCK_PROMISC; | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
|  | @ -109,7 +109,7 @@ static int pty_promisc(patty_client *client, | ||||||
|     setsockopt_request.opt = PATTY_AX25_SOCK_IF; |     setsockopt_request.opt = PATTY_AX25_SOCK_IF; | ||||||
|     setsockopt_request.len = sizeof(ifreq); |     setsockopt_request.len = sizeof(ifreq); | ||||||
| 
 | 
 | ||||||
|     strncpy(ifreq.name, ifname, sizeof(ifreq.name)); |     strncpy(ifreq.name, ifname, sizeof(ifreq.name)-1); | ||||||
|     ifreq.state = PATTY_AX25_SOCK_PROMISC; |     ifreq.state = PATTY_AX25_SOCK_PROMISC; | ||||||
| 
 | 
 | ||||||
|     call = PATTY_CLIENT_SETSOCKOPT; |     call = PATTY_CLIENT_SETSOCKOPT; | ||||||
|  |  | ||||||
|  | @ -458,7 +458,7 @@ int patty_ax25_server_if_add(patty_ax25_server *server, | ||||||
|         goto error_if_fd; |         goto error_if_fd; | ||||||
|     } |     } | ||||||
| 
 | 
 | ||||||
|     strncpy(entry->name, name, sizeof(entry->name)); |     strncpy(entry->name, name, sizeof(entry->name)-1); | ||||||
| 
 | 
 | ||||||
|     entry->iface = iface; |     entry->iface = iface; | ||||||
| 
 | 
 | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue