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

Possibly buffer too short by one? #48

Closed
emmenlau opened this issue Jan 18, 2019 · 1 comment
Closed

Possibly buffer too short by one? #48

emmenlau opened this issue Jan 18, 2019 · 1 comment

Comments

@emmenlau
Copy link

Is it possible that the char buffer in https://github.com/jedisct1/minisign/blob/master/src/base64.c#L77 is too short by one character? If I compile the code as C++ in -pedantic mode, gcc complains that the initializer string is too long. I would guess the compiler adds a zero-terminator at the end? However I'm not an expert for C, maybe there its different?

Please ignore my humble comment if C behaves different than C++ in this aspect.

@jedisct1
Copy link
Owner

This is correct in C, and is the standard way to not include a trailing \0.

C++ is different because strings has different representations; std::string objects are not terminated while C-like strings are.

But Minisign is written in C, not C++.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants