net/sysctl: zero-init stable_secret strings
Sting field sysctl_entry.sarg has wrong length in protobuf encoding in netdev-9 image, according to https://developers.google.com/protocol-buffers/docs/encoding : In netdev-9.img binary representation of sarg field is: "1a 2c 32 36 30 37 3a 66 30 64 30 3a 31 30 30 32 3a 30 30 35 31 3a 30 30 30 30 3a 30 30 30 30 3a 30 30 30 30 3a 30 30 30 34 0a c0 f4 a7 01" Field key is 0x1a - means type 2(Length-delimited field), field 3 - that is sarg field. Field len is 0x2c which is 44, first 40-byte "2607:f0d0:1002:0051:0000:0000:0000:0004\0" and then last 4 - "c0 f4 a7 01" where 0xc0 is not utf-8, and that makes crit fail. In sysctl_op we just read() from sysctl so no '\0' is added in the end of the string. So we can zero-init arrays and that will fix the issue. https://github.com/xemul/criu/issues/161 *Alternatively or additionaly we can put '\0' in the end of string in sysctl_read_char to make it harder to make such a mistake in future. Signed-off-by:Pavel Tikhomirov <ptikhomirov@virtuozzo.com> Acked-by:
Andrew Vagin <avagin@virtuozzo.com> Signed-off-by:
Pavel Emelyanov <xemul@virtuozzo.com>
Showing
Please
register
or
sign in
to comment