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:
Yorhel 2025-03-19 17:33:10 +01:00
parent 7c765f33bb
commit 0925ae79a1
3 changed files with 5 additions and 0 deletions

View file

@ -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;
}