RFR: 8229872: (fs) Increase buffer size used with getmntent
Vladimir Kempik
vkempik at azul.com
Wed Sep 11 11:27:09 UTC 2019
Hello
Please take a look at v9 of webrev http://cr.openjdk.java.net/~vkempik/8229872/webrev.09/ <http://cr.openjdk.java.net/~vkempik/8229872/webrev.09/>
changes:
- getlinelen returns int and all linelens in java are ints now
- integer overflow check at the end of getlinelen
- getmntent_r now uses nativebuffer instead of malloc/free
Thanks, Vladimir
> 9 сент. 2019 г., в 15:17, Florian Weimer <fweimer at redhat.com> написал(а):
>
> * 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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mail.openjdk.java.net/pipermail/nio-dev/attachments/20190911/3d61e000/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 833 bytes
Desc: Message signed with OpenPGP
URL: <https://mail.openjdk.java.net/pipermail/nio-dev/attachments/20190911/3d61e000/signature.asc>
More information about the nio-dev
mailing list