diff options
author | Sergey Bugaev <bugaevc@serenityos.org> | 2020-08-25 17:32:01 +0300 |
---|---|---|
committer | Andreas Kling <kling@serenityos.org> | 2020-08-30 17:35:27 +0200 |
commit | 852454746ea6a6015aa346ef056e5c87ced3a015 (patch) | |
tree | 0a1569488a7ca38226b200eba24b44505fde81bd /Libraries/LibC | |
parent | be6cce5530eac99c8b9c6291e01f600a42ac18f5 (diff) | |
download | serenity-852454746ea6a6015aa346ef056e5c87ced3a015.zip |
Everywhere: Port to String::copy_characters_to_buffer()
Diffstat (limited to 'Libraries/LibC')
-rw-r--r-- | Libraries/LibC/time.cpp | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/Libraries/LibC/time.cpp b/Libraries/LibC/time.cpp index 89e279ec60..5f1c8eeabe 100644 --- a/Libraries/LibC/time.cpp +++ b/Libraries/LibC/time.cpp @@ -304,10 +304,9 @@ size_t strftime(char* destination, size_t max_size, const char* format, const st return 0; } - if (builder.length() + 1 > max_size) - return 0; - strcpy(destination, builder.build().characters()); - return builder.length(); + auto str = builder.build(); + bool fits = str.copy_characters_to_buffer(destination, max_size); + return fits ? str.length() : 0; } long timezone = 0; |