Created
October 26, 2022 21:55
-
-
Save davisp/f65b755493717843f1ba0e3b5f9bc340 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
commit 2b06eb25433f4ef257da293ac7e8ae0f9806bdc2 | |
Author: Paul J. Davis <[email protected]> | |
Date: Wed Oct 26 16:53:01 2022 -0500 | |
Use snprintf to avoid deprecation warnings as errors | |
diff --git a/tiledb/sm/filter/checksum_md5_filter.cc b/tiledb/sm/filter/checksum_md5_filter.cc | |
index 82893bde7..5b10f17b7 100644 | |
--- a/tiledb/sm/filter/checksum_md5_filter.cc | |
+++ b/tiledb/sm/filter/checksum_md5_filter.cc | |
@@ -250,14 +250,14 @@ Status ChecksumMD5Filter::compare_checksum_part( | |
reinterpret_cast<unsigned char*>(computed_hash->data()); | |
char md5string[33]; | |
for (uint64_t i = 0; i < computed_hash->alloced_size(); ++i) { | |
- sprintf(&md5string[i * 2], "%02x", (unsigned int)digest[i]); | |
+ snprintf(&md5string[i * 2], 2, "%02x", (unsigned int)digest[i]); | |
} | |
unsigned char* existing_digest = reinterpret_cast<unsigned char*>(checksum); | |
char md5string_existing[33]; | |
for (uint64_t i = 0; i < Crypto::MD5_DIGEST_BYTES; ++i) { | |
- sprintf( | |
- &md5string_existing[i * 2], "%02x", (unsigned int)existing_digest[i]); | |
+ snprintf( | |
+ &md5string_existing[i * 2], 2, "%02x", (unsigned int)existing_digest[i]); | |
} | |
std::stringstream message; | |
diff --git a/tiledb/sm/filter/checksum_sha256_filter.cc b/tiledb/sm/filter/checksum_sha256_filter.cc | |
index e9b22a3ef..8e1d06bec 100644 | |
--- a/tiledb/sm/filter/checksum_sha256_filter.cc | |
+++ b/tiledb/sm/filter/checksum_sha256_filter.cc | |
@@ -250,14 +250,14 @@ Status ChecksumSHA256Filter::compare_checksum_part( | |
reinterpret_cast<unsigned char*>(computed_hash->data()); | |
char shastring[65]; | |
for (uint64_t i = 0; i < computed_hash->alloced_size(); ++i) { | |
- sprintf(&shastring[i * 2], "%02x", (unsigned int)digest[i]); | |
+ snprintf(&shastring[i * 2], 2, "%02x", (unsigned int)digest[i]); | |
} | |
unsigned char* existing_digest = reinterpret_cast<unsigned char*>(checksum); | |
char shastring_existing[65]; | |
for (uint64_t i = 0; i < Crypto::SHA256_DIGEST_BYTES; ++i) { | |
- sprintf( | |
- &shastring_existing[i * 2], "%02x", (unsigned int)existing_digest[i]); | |
+ snprintf( | |
+ &shastring_existing[i * 2], 2, "%02x", (unsigned int)existing_digest[i]); | |
} | |
std::stringstream message; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment