Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

public methods to extract table aliases from query #302

Merged
merged 1 commit into from
Jan 15, 2019
Merged

public methods to extract table aliases from query #302

merged 1 commit into from
Jan 15, 2019

Conversation

Lagovas
Copy link
Collaborator

@Lagovas Lagovas commented Jan 15, 2019

  • make public GetTablesWithAliases function (was method) and AliasedTableName to reuse it in enterprise code
  • fix govet, use pointer to struct with sync.Once - https://goreportcard.com/report/github.com/cossacklabs/acra
  • return decrypted string as is without encoding to hex if it simple string. it reduces length of packet

fix govet, use pointer to struct with sync.Once
return decrypted string as with without encoding if it simple string
@@ -89,8 +89,8 @@ func DecodeOctal(data []byte) ([]byte, error) {

// DecodeEscaped with hex or octal encodings
func DecodeEscaped(data []byte) ([]byte, error) {
hexdata := data[2:]
if bytes.Equal(data[:2], []byte{'\\', 'x'}) {
if len(data) > 2 && bytes.Equal(data[:2], []byte{'\\', 'x'}) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is data len < 2?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there check of escape type. hex encoding or not. second case printable chars used as is and string may contain <2 characters that are printable and will be correct

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hex encoded must have prefix \x before encoded string so here we check it

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok, got it, thankx

@Lagovas Lagovas merged commit 5db6827 into cossacklabs:master Jan 15, 2019
@Lagovas Lagovas deleted the lagovas/public-table-aliases-extraction branch February 20, 2019 15:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants