Don't allocate too much memory in quote_ref_url
In c13b263, http_fetch_ref got "refs/" included in the ref passed to it,
which, incidentally, makes the allocation in quote_ref_url too big, now.
Signed-off-by: Junio C Hamano <gitster@pobox.com>
			
			
This commit is contained in:
		 Mike Hommey
					Mike Hommey
				
			
				
					committed by
					
						 Junio C Hamano
						Junio C Hamano
					
				
			
			
				
	
			
			
			 Junio C Hamano
						Junio C Hamano
					
				
			
						parent
						
							66115d363a
						
					
				
				
					commit
					7c1a9e7901
				
			
							
								
								
									
										2
									
								
								http.c
									
									
									
									
									
								
							
							
						
						
									
										2
									
								
								http.c
									
									
									
									
									
								
							| @ -583,7 +583,7 @@ static char *quote_ref_url(const char *base, const char *ref) | |||||||
| 	int len, baselen, ch; | 	int len, baselen, ch; | ||||||
|  |  | ||||||
| 	baselen = strlen(base); | 	baselen = strlen(base); | ||||||
| 	len = baselen + 7; /* "/refs/" + NUL */ | 	len = baselen + 2; /* '/' after base and terminating NUL */ | ||||||
| 	for (cp = ref; (ch = *cp) != 0; cp++, len++) | 	for (cp = ref; (ch = *cp) != 0; cp++, len++) | ||||||
| 		if (needs_quote(ch)) | 		if (needs_quote(ch)) | ||||||
| 			len += 2; /* extra two hex plus replacement % */ | 			len += 2; /* extra two hex plus replacement % */ | ||||||
|  | |||||||
		Reference in New Issue
	
	Block a user