Message ID | 1420238358-27553-1-git-send-email-mike.holmes@linaro.org |
---|---|
State | Rejected |
Headers | show |
On 2 January 2015 at 23:39, Mike Holmes <mike.holmes@linaro.org> wrote: > Strings of negitive size overwrite the destination string in > odp_coremask_to_str, acting as infinite size. > > Signed-off-by: Mike Holmes <mike.holmes@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) Why isn't "len" of type size_t? > { > int ret; > > + if (len < 0) { > + ODP_ERR("string has negitive size"); Speling error. > + 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
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) {
Strings of negitive size overwrite the destination string in odp_coremask_to_str, acting as infinite size. Signed-off-by: Mike Holmes <mike.holmes@linaro.org> --- platform/linux-generic/odp_coremask.c | 5 +++++ 1 file changed, 5 insertions(+)