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.
REL8_4_STABLE
Tatsuo Ishii 13 years ago
parent b4cad62511
commit cd99d20550
  1. 2
      src/bin/psql/psqlscan.l

@ -1702,7 +1702,7 @@ prepare_buffer(const char *txt, int len, char **txtcopy)
/* first byte should always be okay... */
newtxt[i] = txt[i];
i++;
while (--thislen > 0)
while (--thislen > 0 && i < len)
newtxt[i++] = (char) 0xFF;
}
}

Loading…
Cancel
Save