aboutsummaryrefslogtreecommitdiffstats
path: root/vespalib
diff options
context:
space:
mode:
authorTor Egge <Tor.Egge@online.no>2023-01-31 12:46:10 +0100
committerTor Egge <Tor.Egge@online.no>2023-01-31 12:46:10 +0100
commit8dca74eb0879fe0e530c783d74a355747422aeec (patch)
tree1558b0d553400bf7a4e14ec01e82358ba8cfd1fd /vespalib
parent82e48e07e3d93521dfc53993a30d7f25ded4a440 (diff)
Use snprintf instead of sprintf.
Diffstat (limited to 'vespalib')
-rw-r--r--vespalib/src/tests/sequencedtaskexecutor/adaptive_sequenced_executor_test.cpp2
-rw-r--r--vespalib/src/tests/sequencedtaskexecutor/sequencedtaskexecutor_test.cpp2
-rw-r--r--vespalib/src/vespa/fastlib/io/bufferedfile.cpp2
3 files changed, 3 insertions, 3 deletions
diff --git a/vespalib/src/tests/sequencedtaskexecutor/adaptive_sequenced_executor_test.cpp b/vespalib/src/tests/sequencedtaskexecutor/adaptive_sequenced_executor_test.cpp
index 1a458f86232..627452e3760 100644
--- a/vespalib/src/tests/sequencedtaskexecutor/adaptive_sequenced_executor_test.cpp
+++ b/vespalib/src/tests/sequencedtaskexecutor/adaptive_sequenced_executor_test.cpp
@@ -160,7 +160,7 @@ vespalib::string makeAltComponentId(Fixture &f)
char altComponentId[20];
ISequencedTaskExecutor::ExecutorId executorId0 = f._threads.getExecutorIdFromName(ZERO);
for (tryCnt = 1; tryCnt < 100; ++tryCnt) {
- sprintf(altComponentId, "%d", tryCnt);
+ snprintf(altComponentId, sizeof(altComponentId), "%d", tryCnt);
if (f._threads.getExecutorIdFromName(altComponentId) == executorId0) {
break;
}
diff --git a/vespalib/src/tests/sequencedtaskexecutor/sequencedtaskexecutor_test.cpp b/vespalib/src/tests/sequencedtaskexecutor/sequencedtaskexecutor_test.cpp
index 705d6346e8c..4c547acc25f 100644
--- a/vespalib/src/tests/sequencedtaskexecutor/sequencedtaskexecutor_test.cpp
+++ b/vespalib/src/tests/sequencedtaskexecutor/sequencedtaskexecutor_test.cpp
@@ -187,7 +187,7 @@ makeAltComponentId(Fixture &f)
char altComponentId[20];
ISequencedTaskExecutor::ExecutorId executorId0 = f._threads->getExecutorIdFromName(ZERO);
for (tryCnt = 1; tryCnt < 100; ++tryCnt) {
- sprintf(altComponentId, "%d", tryCnt);
+ snprintf(altComponentId, sizeof(altComponentId), "%d", tryCnt);
if (f._threads->getExecutorIdFromName(altComponentId) == executorId0) {
break;
}
diff --git a/vespalib/src/vespa/fastlib/io/bufferedfile.cpp b/vespalib/src/vespa/fastlib/io/bufferedfile.cpp
index fa55d0be812..3f5563560d0 100644
--- a/vespalib/src/vespa/fastlib/io/bufferedfile.cpp
+++ b/vespalib/src/vespa/fastlib/io/bufferedfile.cpp
@@ -186,7 +186,7 @@ Fast_BufferedFile::SetPosition(const int64_t s)
diff = _filepos - s;
if ( !(((diff > 0l) || ((diff == 0l) && (_fileleft == 0l))) && (diff <= static_cast<int64_t>(_buf.size())))) {
char tmp[8196];
- sprintf(tmp, "diff %" PRId64 " _fileleft=%" PRId64 " _buflen=%zu", diff, _fileleft, _buf.size());
+ snprintf(tmp, sizeof(tmp), "diff %" PRId64 " _fileleft=%" PRId64 " _buflen=%zu", diff, _fileleft, _buf.size());
abort();
}
}