Skip to content

Commit

Permalink
Fix segfault in checksum formatting
Browse files Browse the repository at this point in the history
sprintf writes three bytes with the trailing null. Depending on how the
compiler lays out the variables, this can trigger a segfault.
  • Loading branch information
jthiltges committed Aug 15, 2018
1 parent 2f498da commit 3bbc6b8
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/XrdHdfsChecksumCalc.cc
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ human_readable_evp(const unsigned char *evp, size_t length)
std::string result; result.reserve(length*2);
for (idx = 0; idx < length; idx++)
{
char encoded[2];
char encoded[3];
sprintf(encoded, "%02x", evp[idx]);
result += encoded;
}
Expand Down

0 comments on commit 3bbc6b8

Please sign in to comment.