Code review comment for lp:~percona-core/percona-server/t12-crash-safe-slave

Revision history for this message
Vlad Lesin (vlad-lesin) wrote :

ha_innodb.cc:2709-2751

strncpy() here does not produce not null-terminated strings in a bound case only because my_b_gets() which is called from init_strvar_from_file() sets 0 at the end of a string if string length from file exceeds maximum length.

Such construction as "char a[LEN]; strncpy(a,b,LEN);" is wrong in common case because if length of 'b' exceeds 'LEN' 'a' will not be null-terminated (see manual page for strncpy()).

I understand this is just a copy from approved code and it works well because my_b_gets() processes bound case well, but such code attracts attention during review.

review: Approve (g2)

« Back to merge proposal