Hi, Michael

We are reviewing this issue, will get back to you if we have progress.

Thanks
Feng

From: Michael Lorer [mailto:[email protected]]
Sent: Wednesday, April 09, 2014 15:04
To: [email protected]
Subject: [edk2] MdeModulePkg maintainer: Possible bug in 
Network/Mtftp4Dxe/Mtftp4Impl.c

Hi,

I think I found a bug in MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Impl.c
Regarding UEFI Specification 2.4 EFI_MTFTP_PROTCOL.GetInfo() (PDF page 1411) in 
the related definitions of Override Data is mentioned that if I use a ServerIp 
address of 0.0.0.0 the currently configured address is used instead.
But the code that checks the incoming Override parameter is checked with this 
function:
https://github.com/tianocore/edk2/blob/master/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Impl.c#L187

BOOLEAN
Mtftp4OverrideValid (
  IN MTFTP4_PROTOCOL          *Instance,
  IN EFI_MTFTP4_OVERRIDE_DATA *Override
  )
{
  EFI_MTFTP4_CONFIG_DATA    *Config;
  IP4_ADDR                  Ip;
  IP4_ADDR                  Netmask;
  IP4_ADDR                  Gateway;

  CopyMem (&Ip, &Override->ServerIp, sizeof (IP4_ADDR));
  if (!NetIp4IsUnicast (NTOHL (Ip), 0)) {
    return FALSE;
  }
...

And if I pass there a 0.0.0.0 ip address the whole function returns FALSE and 
the calling function returns EFI_INVALID_PARAMETER:
https://github.com/tianocore/edk2/blob/master/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Impl.c#L411

Did I get something wrong or is there a bug in the code?
Compared to the gateway the gateway address is only checked with the 
NetIp4IsUnicast-function if it is not null:
https://github.com/tianocore/edk2/blob/master/MdeModulePkg/Universal/Network/Mtftp4Dxe/Mtftp4Impl.c#L196


  if (!Config->UseDefaultSetting && (Gateway != 0)) {

...

Regards,
Michael

------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/NeoTech
_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to