Skip to content

Commit

Permalink
fix bug: string out of bounds when construct illegal tablename error …
Browse files Browse the repository at this point in the history
…message
  • Loading branch information
郑卓彬 committed Jan 15, 2021
1 parent 3488c44 commit e869f89
Showing 1 changed file with 2 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -192,16 +192,14 @@ public static void isLegalTableQualifierName(final byte[] qualifierName,
if(end - start < 1) {
throw new IllegalArgumentException(isSnapshot ? "Snapshot" : "Table" + " qualifier must not be empty");
}
String qualifierString = Bytes.toString(qualifierName, start, end - start);
if (qualifierName[start] == '.' || qualifierName[start] == '-') {
throw new IllegalArgumentException("Illegal first character <" + qualifierName[start] +
"> at 0. " + (isSnapshot ? "Snapshot" : "User-space table") +
" qualifiers can only start with 'alphanumeric " +
"characters' from any language: " +
Bytes.toString(qualifierName, start, end));
qualifierString);
}
// Treat the bytes as UTF-8
String qualifierString = new String(
qualifierName, start, (end - start), StandardCharsets.UTF_8);
if (qualifierString.equals(DISALLOWED_TABLE_NAME)) {
// Per https://zookeeper.apache.org/doc/r3.4.10/zookeeperProgrammers.html#ch_zkDataModel
// A znode named "zookeeper" is disallowed by zookeeper.
Expand Down

0 comments on commit e869f89

Please sign in to comment.