If the template is empty, cyclic memory allocation occurs, which leads to
an out-of-memory error. Its neccessary to check tepmplate string, and if
it is empty, terminate the function.
Testing performed via Libfuzzer.
Signed-off-by: Vitaly Listratenko <[email protected]>
---
diff --git a/lib/dynamic-string.c b/lib/dynamic-string.c
index 8e9555a63..241cff26f 100644
--- a/lib/dynamic-string.c
+++ b/lib/dynamic-string.c
@@ -195,6 +195,10 @@ void
ds_put_strftime_msec(struct ds *ds, const char *template, long long int when,
bool utc)
{
+ if (template == NULL || *template == '\0') {
+ return;
+ }
+
struct tm_msec tm;
if (utc) {
gmtime_msec(when, &tm);
_______________________________________________
dev mailing list
[email protected]
https://mail.openvswitch.org/mailman/listinfo/ovs-dev