@@ -102,11 +102,11 @@ TQueryInfo TStockWorkloadGenerator::FillStockData() const {
102
102
INSERT INTO `stock`(product, quantity) SELECT product, quantity from AS_TABLE( $stocks );
103
103
)" ;
104
104
105
- char productName[8 ] = " " ;
106
105
NYdb::TValueBuilder rows;
107
106
rows.BeginList ();
108
107
for (size_t i = 0 ; i < Params.ProductCount ; ++i) {
109
- std::sprintf (productName, " p%.6zu" , i);
108
+ char productName[8 ] = " " ;
109
+ std::snprintf (productName, sizeof (productName), " p%.6zu" , i);
110
110
rows.AddListItem ()
111
111
.BeginStruct ()
112
112
.AddMember (" product" ).Utf8 (productName)
@@ -238,10 +238,10 @@ unsigned int TStockWorkloadGenerator::GetProductCountInOrder() {
238
238
}
239
239
240
240
TStockWorkloadGenerator::TProductsQuantity TStockWorkloadGenerator::GenerateOrder (unsigned int productCountInOrder, int quantity) {
241
- char productName[8 ] = " " ;
242
241
TProductsQuantity products;
243
242
for (unsigned i = 0 ; i < productCountInOrder; ++i) {
244
- std::sprintf (productName, " p%.6i" , ProductIdGenerator (Gen));
243
+ char productName[8 ] = " " ;
244
+ std::snprintf (productName, sizeof (productName), " p%.6i" , ProductIdGenerator (Gen));
245
245
products.emplace (productName, quantity);
246
246
}
247
247
return products;
@@ -277,7 +277,7 @@ TQueryInfoList TStockWorkloadGenerator::SubmitSameOrder() {
277
277
char productName[8 ] = " " ;
278
278
TProductsQuantity products;
279
279
for (unsigned i = 0 ; i < Params.ProductCount ; ++i) {
280
- std::sprintf (productName, " p%.6i" , i);
280
+ std::snprintf (productName, sizeof (productName) , " p%.6i" , i);
281
281
products.emplace (productName, 1 );
282
282
}
283
283
res.push_back (InsertOrder (orderID, customer, products));
0 commit comments