-
Notifications
You must be signed in to change notification settings - Fork 14
Buffer overflow due to UB #28
Copy link
Copy link
Open
Description
In Interleaf::ReadChunk on line 145, 147 and 156 respectively, it casts an integer to a string. This works most of the time, but is UB. If the int doesn't contain a null byte, then it reads into junk data.
E.g. take line 145 as an example:
desc << ((const char *) &rand_val);
It seems unintended? Wouldn't the following be what is intended?
desc << rand_val;
Otherwise this does the same, just safer:
int len = strnlen((*const char)&rand_val, sizeof(rand_val));
desc << std::string(rand_val, len);
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels