Skip to content
This repository was archived by the owner on Sep 25, 2024. It is now read-only.

Commit deeecff

Browse files
committed
Consider no padding
1 parent b1c6c30 commit deeecff

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

ex-fixed-strings.c

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ int main() {
1212

1313
*(uint32_t *)(ser) = bbp_eint32(BBP_LITTLE, n32);
1414
memcpy(ser + 4, str, str_real_len);
15-
memset(ser + 4 + str_real_len, '\0', str_pad_len);
15+
if (str_pad_len > 0) {
16+
memset(ser + 4 + str_real_len, '\0', str_pad_len);
17+
}
1618
if (bbp_host_endian() != BBP_LITTLE) {
1719
bbp_reverse(ser + 4, str_len);
1820
}

0 commit comments

Comments
 (0)