Skip to content

Commit 8f62ac4

Browse files
authored
WAT: Fix sprintf() security warning (#1532)
1 parent 20123ad commit 8f62ac4

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/libasr/codegen/wasm_to_wat.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -299,7 +299,7 @@ class WATVisitor : public WASMDecoder<WATVisitor>,
299299
escaped_str += ch;
300300
} else {
301301
std::string byte(2, ' ');
302-
sprintf(byte.data(), "%02x", uint8_t(ch));
302+
snprintf(byte.data(), 3, "%02x", uint8_t(ch));
303303
escaped_str += "\\" + byte;
304304
}
305305
}

0 commit comments

Comments
 (0)