-
Notifications
You must be signed in to change notification settings - Fork 73
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
pmcx buffer overflow error if bc parameter has 12 characters #191
Comments
- mcx_config.bc has type char[12], with no null terminator required - resolves fangq#191
after checking the code, I found the issue you mentioned here also presents in mcxlab (and mcxcl). Because in mcxlab, I have been using cfg->bc as a NULL-terminating string for printing while in nearly all other places, I only read the first 12 bytes for bc flags. To avoid issues of mixing use as a string as well as a byte array, I decided to expand the bc[] array in cfg to 13 to allow the ending NULL, 68db492 following this change, I also adjusted mcxlab.cpp and pmcx.cpp to handle the size checking and copying accordingly, see my above tagged commit. Let me know if you see any problem. |
- contains fix for github.com/fangq/issues/191
Setting
'bc': '______000010'
gives:If I remove the last character,
'bc': '______00001'
, then it runs without errors.The text was updated successfully, but these errors were encountered: