RFR: 8229872: (fs) Increase buffer size used with getmntent

Florian Weimer fweimer at redhat.com
Mon Sep 9 12:17:47 UTC 2019


* Vladimir Kempik:

> Hello 
> such custing (from long to int) were needed only because getmntent_r expects last argument to be int
>
> https://linux.die.net/man/3/getmntent_r
> struct mntent *getmntent_r(FILE *fp, struct mntent *mntbuf, char *buf, int buflen); 
>
> so could you please clarify ?

Hmm.  Indeed.  It looks like our implementation getmntent_r returns NULL
without setting errno if buflen is negative.

> since getlinelen returns long, I see no issue so far.

What if getlinelen computes a line length longer than INT_MAX?  I think
all the uses are consistent here, so it is not an immediately problem.

Would it make sense to check for INT_MAX in
Java_sun_nio_fs_UnixNativeDispatcher_getlinelen and throw an exception
(say with EOVERFLOW) there?

Thanks,
Florian


More information about the nio-dev mailing list