On 10:45 Tue 14 Apr     , Hal Rosenstock wrote:
> 
> Signed-off-by: Hal Rosenstock <[email protected]>

Applied. Thanks. See note below.

> +                             for (i = 0;
> +                                  i <= 
> (p_ntci->data_details.ntc_256.dr_trunc_hop & 0x3f);
> +                                  i++) {
> +                                     if (i == 0)
> +                                             n += snprintf(buff + n, 
> sizeof(buff) - n, "%d",
> +                                                     
> p_ntci->data_details.ntc_256.dr_rtn_path[i]);
> +                                     else
> +                                             n += snprintf(buff + n, 
> sizeof(buff) - n, ",%d",
> +                                                     
> p_ntci->data_details.ntc_256.dr_rtn_path[i]);

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)) {
                n = sizeof(buff) - 2;
                break;
        }

(in order to preserve space for new line).

Sasha
_______________________________________________
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