Strings of negitive size overwrite the destination string in
odp_coremask_to_str, acting as infinite size.

Signed-off-by: Mike Holmes <mike.hol...@linaro.org>
---
 platform/linux-generic/odp_coremask.c | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/platform/linux-generic/odp_coremask.c 
b/platform/linux-generic/odp_coremask.c
index 5b4e961..5161008 100644
--- a/platform/linux-generic/odp_coremask.c
+++ b/platform/linux-generic/odp_coremask.c
@@ -34,6 +34,11 @@ void odp_coremask_to_str(char *str, int len, const 
odp_coremask_t *mask)
 {
        int ret;
 
+       if (len < 0) {
+               ODP_ERR("string has negitive size");
+               return;
+       }
+
        ret = snprintf(str, len, "0x%"PRIx64"", mask->_u64[0]);
 
        if (ret >= 0 && ret < len) {
-- 
2.1.0


_______________________________________________
lng-odp mailing list
lng-odp@lists.linaro.org
http://lists.linaro.org/mailman/listinfo/lng-odp

Reply via email to