html: fix handling of null byte
A return value of `len` or more means that the output was truncated. Signed-off-by: Peter Prohaska <pitrp@web.de> Signed-off-by: Christian Hesse <mail@eworm.de>
This commit is contained in:
		
							parent
							
								
									4e4b30effb
								
							
						
					
					
						commit
						ce2062d9e2
					
				
							
								
								
									
										2
									
								
								html.c
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								html.c
									
									
									
									
									
								
							| @ -59,7 +59,7 @@ char *fmt(const char *format, ...) | |||||||
| 	va_start(args, format); | 	va_start(args, format); | ||||||
| 	len = vsnprintf(buf[bufidx], sizeof(buf[bufidx]), format, args); | 	len = vsnprintf(buf[bufidx], sizeof(buf[bufidx]), format, args); | ||||||
| 	va_end(args); | 	va_end(args); | ||||||
| 	if (len > sizeof(buf[bufidx])) { | 	if (len >= sizeof(buf[bufidx])) { | ||||||
| 		fprintf(stderr, "[html.c] string truncated: %s\n", format); | 		fprintf(stderr, "[html.c] string truncated: %s\n", format); | ||||||
| 		exit(1); | 		exit(1); | ||||||
| 	} | 	} | ||||||
|  | |||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user