diff options
Diffstat (limited to 'Libraries/LibC/time.cpp')
-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; |