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

Not-safe function strcpy, possible buffer overflow #901

Closed
mad opened this Issue Feb 26, 2012 · 3 comments

Comments

Projects
None yet
3 participants
@mad

mad commented Feb 26, 2012

@sipa

This comment has been minimized.

Show comment
Hide comment
@sipa

sipa Feb 26, 2012

Member

So we just need an strlen check before copying, as no meaningful value in APPDATA is longer than MAX_PATH?

Member

sipa commented Feb 26, 2012

So we just need an strlen check before copying, as no meaningful value in APPDATA is longer than MAX_PATH?

@laanwj

This comment has been minimized.

Show comment
Hide comment
@laanwj

laanwj Feb 26, 2012

Member

Maybe we should strive to use safe C++ string functions everywhere, instead of archaic strcpy/strcat buffer manipulation.

Edit: especially in this case, as the function returns a std::string already.

Edit2: the rest of the function could be simplified too, to simply call SHGetSpecialFolderPathA, as we require _WINNT 0x0501 (Windows XP) and the function was introduced in 5.0 (Windows 2000).

Member

laanwj commented Feb 26, 2012

Maybe we should strive to use safe C++ string functions everywhere, instead of archaic strcpy/strcat buffer manipulation.

Edit: especially in this case, as the function returns a std::string already.

Edit2: the rest of the function could be simplified too, to simply call SHGetSpecialFolderPathA, as we require _WINNT 0x0501 (Windows XP) and the function was introduced in 5.0 (Windows 2000).

@sipa

This comment has been minimized.

Show comment
Hide comment
@sipa

sipa Feb 28, 2012

Member

Fixed in #902.

Member

sipa commented Feb 28, 2012

Fixed in #902.

@sipa sipa closed this Feb 28, 2012

coblee pushed a commit to litecoin-project/litecoin that referenced this issue Jul 17, 2012

suprnurd pushed a commit to chaincoin-legacy/chaincoin that referenced this issue Dec 5, 2017

ptschip pushed a commit to ptschip/bitcoin that referenced this issue Jan 11, 2018

Merge pull request bitcoin#901 from ptschip/dev_dateformat
Fix for bitcoin#846: remove extra space between year and month in debug ui.

ptschip pushed a commit to ptschip/bitcoin that referenced this issue Jan 19, 2018

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment