Change the failure mode in option parsing to silently bailing out of option

negotiation rather than rejecting the request.

Apple OpenFirmware 3.0f3 (the version in my iMac) adds trailing garbage to the
end of an otherwise valid request.  Without this change, the requests were
rejected which prevented me from booting.

Reviewed by:	obrien
This commit is contained in:
Benno Rice 2001-11-22 05:08:35 +00:00
parent be2ac88c59
commit 14f0ab1c53
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=86765

View File

@ -371,8 +371,14 @@ tftp(tp, size)
while (++cp < buf + size) {
for (i = 2, ccp = cp; i > 0; ccp++) {
if (ccp >= buf + size) {
nak(EBADOP);
exit(1);
/*
* Don't reject the request, just stop trying
* to parse the option and get on with it.
* Some Apple OpenFirmware versions have
* trailing garbage on the end of otherwise
* valid requests.
*/
goto option_fail;
} else if (*ccp == '\0')
i--;
}
@ -387,6 +393,7 @@ tftp(tp, size)
cp = ccp-1;
}
option_fail:
if (options[OPT_TIMEOUT].o_request) {
int to = atoi(options[OPT_TIMEOUT].o_request);
if (to < 1 || to > 255) {