mirror of
				https://github.com/subsurface/subsurface.git
				synced 2025-02-19 22:16:15 +00:00 
			
		
		
		
	Fix silly crash
Who the heck uses strcpy? Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
		
							parent
							
								
									f61ee20ba3
								
							
						
					
					
						commit
						272f85bb24
					
				
					 1 changed files with 5 additions and 3 deletions
				
			
		
							
								
								
									
										8
									
								
								dive.c
									
										
									
									
									
								
							
							
						
						
									
										8
									
								
								dive.c
									
										
									
									
									
								
							|  | @ -2486,9 +2486,11 @@ void set_save_userid_local(short value) | |||
| 
 | ||||
| void set_userid(char *rUserId) | ||||
| { | ||||
| 	prefs.userid = (char *) malloc(MAX_USERID_SIZE); | ||||
| 	if (prefs.userid && rUserId) | ||||
| 		strcpy(prefs.userid, rUserId); | ||||
| 	prefs.userid = (char *) malloc(MAX_USERID_SIZE + 1); | ||||
| 	if (prefs.userid && rUserId) { | ||||
| 		strncpy(prefs.userid, rUserId, MAX_USERID_SIZE); | ||||
| 		prefs.userid[MAX_USERID_SIZE] = 0; | ||||
| 	} | ||||
| } | ||||
| #undef MAX_USERID_SIZE | ||||
| 
 | ||||
|  |  | |||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue