Internals: Use snprintf for random unique indexes (#7925)

This commit is contained in:
Jeffrey Song 2026-07-13 11:35:22 -07:00 committed by GitHub
parent dde8de0a0d
commit 4262aea87c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 1 deletions

View File

@ -126,6 +126,8 @@ Jamie Iles
Jan Van Winkel
Jean Berniolles
Jean-Nicolas Strauss
Jeffrey Song
jeffrey.song
Jens Yuechao Liu
Jeremy Bennett
Jesse Taube

View File

@ -496,7 +496,7 @@ bool VlRandomizer::next(VlRNG& rngr) {
std::string distinctExpr = "(__Vbv (distinct";
for (uint32_t i = 0; i < size; ++i) {
char hexIdx[12];
sprintf(hexIdx, "#x%08x", i);
(void)VL_SNPRINTF(hexIdx, sizeof(hexIdx), "#x%08x", i);
distinctExpr += " (select " + it->first + " " + hexIdx + ")";
}
distinctExpr += "))";