XS: Ensure created Perl strings are nul-terminated
Most of these are binary strings and shouldn't be interpreted as C strings in the first place, but better be safe in case they are, anyway. The lack of nul-termination of FU::Pg `$hex` strings was more likely to be problematic.
This commit is contained in:
parent
7c765f33bb
commit
0925ae79a1
3 changed files with 5 additions and 0 deletions
|
|
@ -166,6 +166,7 @@ RECVFN(hex) {
|
|||
*out++ = PL_hexdigit[(in[i] >> 4) & 0x0f];
|
||||
*out++ = PL_hexdigit[in[i] & 0x0f];
|
||||
}
|
||||
*out = 0;
|
||||
SvCUR_set(r, len * 2);
|
||||
return r;
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue