mirror of
				https://github.com/swaywm/sway.git
				synced 2025-11-03 09:01:43 -05:00 
			
		
		
		
	Merge pull request #1270 from tobiasblass/bindsym_use_after_free
fix use-after-free bug
This commit is contained in:
		
						commit
						8fad213f34
					
				
					 1 changed files with 3 additions and 2 deletions
				
			
		| 
						 | 
					@ -61,10 +61,11 @@ struct cmd_results *cmd_bindsym(int argc, char **argv) {
 | 
				
			||||||
			sym = ((char *)split->items[i])[strlen("button")] - '1' + M_LEFT_CLICK;
 | 
								sym = ((char *)split->items[i])[strlen("button")] - '1' + M_LEFT_CLICK;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		if (!sym) {
 | 
							if (!sym) {
 | 
				
			||||||
 | 
								struct cmd_results *ret = cmd_results_new(CMD_INVALID, "bindsym",
 | 
				
			||||||
 | 
										"Unknown key '%s'", (char *)split->items[i]);
 | 
				
			||||||
			free_sway_binding(binding);
 | 
								free_sway_binding(binding);
 | 
				
			||||||
			free_flat_list(split);
 | 
								free_flat_list(split);
 | 
				
			||||||
			return cmd_results_new(CMD_INVALID, "bindsym", "Unknown key '%s'",
 | 
								return ret;
 | 
				
			||||||
					(char *)split->items[i]);
 | 
					 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
		xkb_keysym_t *key = malloc(sizeof(xkb_keysym_t));
 | 
							xkb_keysym_t *key = malloc(sizeof(xkb_keysym_t));
 | 
				
			||||||
		if (!key) {
 | 
							if (!key) {
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue