Skip to content
Tcl Source Code View Ticket
Login

View Ticket

Patch for short array in GetPermissionsAttribute

Closed / Fixed218455ffffffffffffffffffffffffffffffffffCreated 26 years agoUpdated 26 years ago
Descriptionplain2000-10-26 01:00:36
OriginalBugID: 584 Bug
Version: 8.1a2
SubmitDate: '1998-05-21'
LastModified: '1998-12-08'
Severity: SER
Status: Released
Submitter: hershey
ChangedBy: stanton
OS: All
OSVersion: NA
Machine: NA
FixedDate: '1998-12-08'
FixedInVersion: 8.1b1
ClosedDate: '2000-10-25'


In Tcl8.1a2, the function GetPermissionsAttribute in

unix/tclUnixFCmd.c declares the array returnString to be 6 characters.

It then writes into it using sprintf with a format string of "%0#5lo".

This format string will print at least one `0' because of the #,

followed by up to 5 characters.  This can mean returning a string with

six characters, overflowing the declared size of the array.


I have appended the obvious patch.


Incidentally, the comment above this function refers to the group

attribute of the file, probably a bad copy from GetGroupAttribute.


Ian Taylor

[email protected]


*** tclUnixFCmd.c.~1~   Fri Apr 10 17:14:19 1998

--- tclUnixFCmd.c       Fri Apr 10 17:14:37 1998

*************** GetPermissionsAttribute(interp, objIndex

*** 1168,1174 ****

      Tcl_Obj **attributePtrPtr;            /* A pointer to return the object with. */

  {

      struct stat statBuf;

!     char returnString[6];

      Tcl_DString ds;

      CONST char *native;

      int result;

--- 1168,1174 ----

      Tcl_Obj **attributePtrPtr;            /* A pointer to return the object with. */

  {

      struct stat statBuf;

!     char returnString[7];

      Tcl_DString ds;

      CONST char *native;

      int result;




12/08/1998 13:24 - stanton - This patch was applied 11/30/98.
welch Closed ticket [218455ffff]. [History diff]2000-10-26 08:22:16
dgp Ticket [218455ffff]: 3 changes [History diff]2001-04-17 04:23:05
Log in (anonymous is fine) to add a comment.