mirror of
				https://github.com/postgres/postgres.git
				synced 2025-11-03 09:13:20 +03:00 
			
		
		
		
	Fix psql crash while parsing SQL file whose encoding is different from
client encoding and the client encoding is not *safe* one. Such an example is, file encoding is UTF-8 and client encoding SJIS. Patch contributed by Jiang Guiqing.
This commit is contained in:
		@@ -1803,7 +1803,7 @@ prepare_buffer(const char *txt, int len, char **txtcopy)
 | 
				
			|||||||
			/* first byte should always be okay... */
 | 
								/* first byte should always be okay... */
 | 
				
			||||||
			newtxt[i] = txt[i];
 | 
								newtxt[i] = txt[i];
 | 
				
			||||||
			i++;
 | 
								i++;
 | 
				
			||||||
			while (--thislen > 0)
 | 
								while (--thislen > 0 && i < len)
 | 
				
			||||||
				newtxt[i++] = (char) 0xFF;
 | 
									newtxt[i++] = (char) 0xFF;
 | 
				
			||||||
		}
 | 
							}
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user