Hi,

I just noticed this bit of code in libports:

  if (size < sizeof (struct port_info))
    size = sizeof (struct port_info);

"size" is passed from the caller, and should describe the size of the per-port
structure; i.e. the size of the standard stuff managed by libports itself
(struct port_info), plus any additional info the user wants to store there.

The above code means that if a caller passes a bogus size, instead of screaming
loudly, it is silently ignored?! I can't see how this can be useful :-(

(I guess it *might* make sense to special-case a "0" size, if the caller simply
is not interested in any additional data -- though I'm not sure that's ever
useful. But other cases are definitely bogus.)

-antrik-


Reply via email to