Einzelnen Beitrag anzeigen

Benutzerbild von himitsu
himitsu
Online

Registriert seit: 11. Okt 2003
Ort: Elbflorenz
43.153 Beiträge
 
Delphi 12 Athens
 
#3

AW: Lokale string Variable als Zwischenspeicher benötigt

  Alt 26. Aug 2021, 10:41
Außerdem ist cnMaxUserNameLen total falsch.
* erstmal 254 statt 256
* und wird -1 statt +1 für die #0

Delphi-Strings haben zwar #0#0 eingebaut, aber dennoch könnte es somit einen Speicherüberlauf von 2 Chars / 4 Bytes geben.

Zitat:
Code:
/*
    This file contains constants used throughout the LAN Manager
    API header files. It should be included in any source file
    that is going to include other LAN Manager API header files or
    call a LAN Manager API.

    NOTE: Lengths of strings are given as the maximum lengths of the
    string in characters (not bytes). This does not include space for the
    terminating 0-characters. When allocating space for such an item,
    use the form:

        TCHAR username[UNLEN+1];
*/

#define UNLEN      256                 // Maximum user name length
Garbage Collector ... Delphianer erzeugen keinen Müll, also brauchen sie auch keinen Müllsucher.
my Delphi wish list : BugReports/FeatureRequests
  Mit Zitat antworten Zitat