On Tue, Apr 14, 2009 at 1:03 PM, Hal Rosenstock
<[email protected]> wrote:

<snip...>

>> When snprintf() overflows it returns number of bytes which would be
>> written otherwise, so return value should be checked anyway. So I'm
>> adding this:
>>
>>        if (n >= sizeof(buf)) {
>                               ^^^
>                               buff
>
>>                n = sizeof(buff) - 2;
>>                break;
>>        }
>>
>> (in order to preserve space for new line).
>
> Sounds right.
>
> Doesn't this same issue exist elsewhere in opensm where snprintf is
> used and the return value is not checked in comparison to the size
> supplied ?

I take that back; I audited the other places and they look fine to me.
There are some changes which will make it less likely to fail if some
buffer size is changed though. I will make up a patch for that in due
time.

-- Hal
_______________________________________________
general mailing list
[email protected]
http://lists.openfabrics.org/cgi-bin/mailman/listinfo/general

To unsubscribe, please visit http://openib.org/mailman/listinfo/openib-general

Reply via email to