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

Eliminate all instances of SOS_DEFAULT_STRING_LEN #43

Open
cdwdirect opened this issue Jun 26, 2018 · 0 comments
Open

Eliminate all instances of SOS_DEFAULT_STRING_LEN #43

cdwdirect opened this issue Jun 26, 2018 · 0 comments

Comments

@cdwdirect
Copy link
Owner

Fixed-length strings and such strings stored in stack variables, even when carefully clamped and explicitly null-terminated, were a bad choice made in the early days of SOSflow implementation, before I knew better.

All SOS_DEFAULT_STRING_LEN instances should be removed from SOSflow. Strings should be unbounded in length, allocated, and memset to null, on the heap, period.

PROPOSED: Make simple wrapper functions...
char *SOS_string_copy(const char *);
void SOS_string_destroy(char *);
bool SOS_string_is_initalized(char **);
...OR...
// Create a std::string-style object for SOS, since SOS is written in C99.
SOS_string *name;
... so we have a single location where we can plug in various sanity checks, potential memory use optimizations like hashed-dupes with refcounts, and update the sosd_probe counts for memory usage related to strings.

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

1 participant