Done at r13691

From: Tian, Feng [mailto:[email protected]]
Sent: Monday, August 27, 2012 16:40
To: [email protected]
Subject: Re: [edk2] StrSize vs StrLen

Hi, Isakov

I reviewed the modules you mentioned in MdeModulePkg and agree with you it's 
bug to be fixed.
Will fix it as soon as possible.

Thanks
Feng

From: Sergey Isakov [mailto:[email protected]]<mailto:[mailto:[email protected]]>
Sent: Monday, August 27, 2012 3:37 PM
To: [email protected]<mailto:[email protected]>
Subject: [edk2] StrSize vs StrLen

Dear sirs,

Sorry for returning for the issue. I collected some more problematic places. 
Look, please
Usage of the function UnicodeSPrint (char16_string, sizeof(char16_string), fmt, 
...)
But in some places there is not sizeof /StrSize but StrLen that is wrong.
See
edk2/IntelFrameworkModulePkg/Universal/BdsDxe/BootMaint/UpdatePage.c
  CHAR16                    StrTemp[100];
    UnicodeSPrint (StrTemp, 100, L"Boot%04x", OrderBuffer[Index]);

edk2/MdeModulePkg/Universal/Network/IScsiDxe/IScsiConfig.c
  CHAR16                         PortString[ISCSI_NAME_IFR_MAX_SIZE];
    UnicodeSPrint (
      PortString,
      (UINTN) ISCSI_NAME_IFR_MAX_SIZE,
      L"Error! Input is incorrect, please input 6 hex numbers!\n"
      );

  CHAR16                    PortString[128];
      UnicodeSPrint (PortString, (UINTN) 128, L"Port %s", 
ConfigFormEntry->MacString);
      UnicodeSPrint (PortString, 128, L"Port %s", ConfigFormEntry->MacString);
      UnicodeSPrint (PortString, 128, L"Set the iSCSI parameters on port %s", 
ConfigFormEntry->MacString);

edk2/MdeModulePkg/Universal/SetupBrowserDxe/Expression.c
  CHAR16         Buffer[MAXIMUM_VALUE_CHARACTERS];
    UnicodeSPrint (Buffer, MAXIMUM_VALUE_CHARACTERS, PrintFormat, Value.Buffer);

And the most critical in common libraries
edk2/MdePkg/Library/UefiDebugLibConOut/DebugLib.c
edk2/MdePkg/Library/UefiDebugLibStdErr/DebugLib.c
  CHAR16  Buffer[MAX_DEBUG_MESSAGE_LENGTH];

  //
  // Generate the ASSERT() message in Unicode format
  //
  UnicodeSPrintAsciiFormat (
    Buffer,
    MAX_DEBUG_MESSAGE_LENGTH,
    "ASSERT %a(%d): %a\n",
    FileName,
    LineNumber,
    Description
    );

In all these places second argument must be twice larger.

Hope you understand me.

Sergey
------------------------------------------------------------------------------
Live Security Virtual Conference
Exclusive live event will cover all the ways today's security and 
threat landscape has changed and how IT managers can respond. Discussions 
will include endpoint security, mobile security and the latest in malware 
threats. http://www.accelacomm.com/jaw/sfrnl04242012/114/50122263/
_______________________________________________
edk2-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/edk2-devel

Reply via email to