I get the following error during compilation:
benchmarks/tpcc_txn.cpp: In member function ‘RC tpcc_txn_man::run_payment(tpcc_query*)’:
benchmarks/tpcc_txn.cpp:211:9: error: ‘char* strncpy(char*, const char*, size_t)’ output may be truncated copying 10 bytes from a string of length 10 [-Werror=stringop-truncation]
211 | strncpy(h_data, w_name, 10);
| ~~~~~~~^~~~~~~~~~~~~~~~~~~~
I think that this is due to the fact that w_name is declared as 11 characters long (with the last character likely being NULL), but only the first 10 are copied here. Is this intended? It seems to me that, if the character array is not null-terminated, that can cause problems for the strlen call afterwards, even if it's not needed in the end because multiple strings are being joined.
I get the following error during compilation:
I think that this is due to the fact that
w_nameis declared as 11 characters long (with the last character likely being NULL), but only the first 10 are copied here. Is this intended? It seems to me that, if the character array is not null-terminated, that can cause problems for thestrlencall afterwards, even if it's not needed in the end because multiple strings are being joined.