mirror of
				https://github.com/Tha14/toxic.git
				synced 2025-10-31 18:56:51 +01:00 
			
		
		
		
	core: Fix a possible buffer overflow using getself_name().
If the passed buffer is smaller than MAX_NAME_LENGTH then, you will probably overflow it.
This commit is contained in:
		
							
								
								
									
										2
									
								
								chat.c
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								chat.c
									
									
									
									
									
								
							| @@ -210,7 +210,7 @@ void execute(ToxWindow *self, ChatContext *ctx, Messenger *m, char *cmd, struct | |||||||
|     wattroff(ctx->history, COLOR_PAIR(2)); |     wattroff(ctx->history, COLOR_PAIR(2)); | ||||||
|  |  | ||||||
|     uint8_t selfname[MAX_NAME_LENGTH]; |     uint8_t selfname[MAX_NAME_LENGTH]; | ||||||
|     int len = getself_name(m, selfname); |     int len = getself_name(m, selfname, sizeof(selfname)); | ||||||
|     char msg[MAX_STR_SIZE-len-4]; |     char msg[MAX_STR_SIZE-len-4]; | ||||||
|     snprintf(msg, sizeof(msg), "* %s %s\n", (uint8_t*) selfname, action); |     snprintf(msg, sizeof(msg), "* %s %s\n", (uint8_t*) selfname, action); | ||||||
|  |  | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user