mirror of
				https://github.com/Telecominfraproject/wlan-ap.git
				synced 2025-10-30 18:07:52 +00:00 
			
		
		
		
	spotfilter: fix a use-after-free
Signed-off-by: John Crispin <john@phrozen.org>
This commit is contained in:
		 John Crispin
					John Crispin
				
			
				
					committed by
					
						 jaspreetsachdev
						jaspreetsachdev
					
				
			
			
				
	
			
			
			 jaspreetsachdev
						jaspreetsachdev
					
				
			
						parent
						
							9c2f0a098d
						
					
				
				
					commit
					41c64e9978
				
			| @@ -65,6 +65,7 @@ static void __client_free(struct interface *iface, struct client *cl) | |||||||
| 		avl_delete(&iface->client_ids, &cl->id_node); | 		avl_delete(&iface->client_ids, &cl->id_node); | ||||||
| 	avl_delete(&iface->clients, &cl->node); | 	avl_delete(&iface->clients, &cl->node); | ||||||
| 	kvlist_free(&cl->kvdata); | 	kvlist_free(&cl->kvdata); | ||||||
|  | 	free(cl->device); | ||||||
| 	spotfilter_bpf_set_client(iface, &cl->key, NULL); | 	spotfilter_bpf_set_client(iface, &cl->key, NULL); | ||||||
| 	free(cl); | 	free(cl); | ||||||
| } | } | ||||||
| @@ -143,8 +144,10 @@ int client_set(struct interface *iface, const void *addr, const char *id, | |||||||
|  |  | ||||||
| 		kvlist_set(&cl->kvdata, blobmsg_name(cur), cur); | 		kvlist_set(&cl->kvdata, blobmsg_name(cur), cur); | ||||||
| 	} | 	} | ||||||
| 	if (device) | 	if (device) { | ||||||
| 		cl->device = device; | 		free(cl->device); | ||||||
|  | 		cl->device = strdup(device); | ||||||
|  | 	} | ||||||
| 	if (state >= 0) | 	if (state >= 0) | ||||||
| 		cl->data.cur_class = state; | 		cl->data.cur_class = state; | ||||||
| 	if (dns_state >= 0) | 	if (dns_state >= 0) | ||||||
|   | |||||||
| @@ -17,7 +17,7 @@ struct client { | |||||||
|  |  | ||||||
| 	struct spotfilter_client_key key; | 	struct spotfilter_client_key key; | ||||||
| 	struct spotfilter_client_data data; | 	struct spotfilter_client_data data; | ||||||
| 	const char *device; | 	char *device; | ||||||
| }; | }; | ||||||
|  |  | ||||||
| int client_set(struct interface *iface, const void *addr, const char *id, | int client_set(struct interface *iface, const void *addr, const char *id, | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user