Page MenuHomeFreeBSD

md5: Fix input error check.
ClosedPublic

Authored by des on May 9 2023, 7:30 AM.
Tags
None
Referenced Files
F144358413: D40017.id121725.diff
Sun, Feb 8, 1:04 AM
F144348829: D40017.id121780.diff
Sat, Feb 7, 11:43 PM
Unknown Object (File)
Sat, Jan 31, 3:48 PM
Unknown Object (File)
Wed, Jan 14, 5:14 PM
Unknown Object (File)
Wed, Jan 14, 4:25 PM
Unknown Object (File)
Wed, Jan 14, 2:21 PM
Unknown Object (File)
Fri, Jan 9, 11:03 AM
Unknown Object (File)
Jan 8 2026, 12:46 AM
Subscribers

Details

Summary

Fixes: 4849767cb16a
MFC after: 1 week
Sponsored by: Klara, Inc.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped
Build Status
Buildable 51390
Build 48281: arc lint + arc unit

Event Timeline

des requested review of this revision.May 9 2023, 7:30 AM
tsoome added inline comments.
sbin/md5/md5.c
685

There is actually potential problem. fread() can return value between 0 to sizeof(block) in case of error or eof, I guess it is ok to have short read in case of eof, but we probably want to be sure there was no error.

It may be better to use do {} while (!ferror() && !feof()) loop there.

689

len is already size_t, you can drop the type cast.

des marked an inline comment as done.May 9 2023, 9:50 AM
des added inline comments.
sbin/md5/md5.c
685

I don't see the problem. The next fread() would return zero which ends the loop, and ferror() after that will return non-zero and we will report the error.

des marked an inline comment as done.May 9 2023, 9:50 AM

Remove unnecessary cast.

This revision is now accepted and ready to land.May 9 2023, 10:34 AM

I can confirm this fix the building issue with gcc12.

This revision was automatically updated to reflect the committed changes.