-
Notifications
You must be signed in to change notification settings - Fork 859
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This commit fixes a memory corruption bug when parsing lines of the form: -x FOO=bar The code was making changes to the size of the buffer allocated for key_buffer without making the appropriate changes to key_buffer_len. This was causing subsequent calls to save_param_name to write to invalid memory. This commit makes the following changes: - Fix the above bug by modifying trim_name to move the string within the buffer instead of re-allocating space for the trimmed string. - Cleaned up both trim_name and save_param_name. Both functions took a prefix and suffix to trim. Problem was the prefix was not treated like a prefix. Instead the "prefix" was located inside the string using strstr then the trimmed value started after the substring (even in the middle of the string). To allow trimming both -x and --x (as well as -mca and --mca) trim_name is now called with each prefix. Signed-off-by: Nathan Hjelm <hjelmn@lanl.gov>
- Loading branch information
Showing
1 changed file
with
55 additions
and
38 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters