[3.12] gh-105017: Fix including additional NL token when using CRLF (GH-105022) (#105023)

Co-authored-by: Marta Gómez Macías <mgmacias@google.com>
Co-authored-by: Pablo Galindo Salgado <Pablogsal@gmail.com>
This commit is contained in:
Miss Islington (bot) 2023-05-27 10:24:30 -07:00 committed by GitHub
parent edd0cb8e77
commit 2b176bc902
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 10 additions and 1 deletions

View file

@ -800,7 +800,7 @@ translate_newlines(const char *s, int exec_input, struct tok_state *tok) {
}
/* If this is exec input, add a newline to the end of the string if
there isn't one already. */
if (exec_input && c != '\n') {
if (exec_input && c != '\n' && c != '\0') {
*current = '\n';
current++;
}