strndup() could return a non-NULL terminated string
size_t should be printed with %lu when expending tildes (~), an extra slash was inserted after the user's home directory
This commit is contained in:
		
							parent
							
								
									bb62e2c18d
								
							
						
					
					
						commit
						2881d173b5
					
				
					 2 changed files with 4 additions and 1 deletions
				
			
		
							
								
								
									
										3
									
								
								config.c
									
										
									
									
									
								
							
							
						
						
									
										3
									
								
								config.c
									
										
									
									
									
								
							|  | @ -79,7 +79,10 @@ expand_strdup (const char *s) | ||||||
| 
 | 
 | ||||||
| 	    p = strchr (s, '/'); | 	    p = strchr (s, '/'); | ||||||
| 	    if (p) | 	    if (p) | ||||||
|  | 	    { | ||||||
| 		user = strndup (s, (int)(p - s)); | 		user = strndup (s, (int)(p - s)); | ||||||
|  | 		p++; | ||||||
|  | 	    } | ||||||
| 	    else | 	    else | ||||||
| 		user = strdup (s); | 		user = strdup (s); | ||||||
| 	    pw = getpwnam (user); | 	    pw = getpwnam (user); | ||||||
|  |  | ||||||
							
								
								
									
										2
									
								
								sync.c
									
										
									
									
									
								
							
							
						
						
									
										2
									
								
								sync.c
									
										
									
									
									
								
							|  | @ -117,7 +117,7 @@ sync_mailbox (mailbox_t * mbox, imap_t * imap, int flags, | ||||||
| 		{ | 		{ | ||||||
| 		    if ((flags & SYNC_QUIET) == 0) | 		    if ((flags & SYNC_QUIET) == 0) | ||||||
| 			printf | 			printf | ||||||
| 			    ("Warning, local message is too large (%ld), skipping...\n", | 			    ("Warning, local message is too large (%lu), skipping...\n", | ||||||
| 			     sb.st_size); | 			     sb.st_size); | ||||||
| 		    continue; | 		    continue; | ||||||
| 		} | 		} | ||||||
|  |  | ||||||
		Loading…
	
	Add table
		
		Reference in a new issue