Skip to content
Tcl Source Code Ticket Change Details
Login

Ticket Change Details

Overview

Artifact ID: 2bb7aed66ad4c8cb8cf127bf3983a6a54ef6ea1f1c5edb8cd6dffa724363956d
Ticket: 7079e4f91601e9c784e151e86c9d7821afdd45fe
A stack overflow vulnerability in Tcl nmakehelp.c allows code execution via a crated file
User & Date: salmonx on 2021-06-22 07:49:25
Changes

  1. assignee changed to: "nobody"
  2. closer changed to: "nobody"
  3. cmimetype changed to: "text/html"
  4. comment changed to:
    <p>
    A stack overflow vulnerability in Tcl nmakehelp.c allows code execution via a crated file
    </p>
    
    <p> The length of local variable 'szBuffer' in GetVersionFromFile is 100. szBuffer can be controlled via crafted argv.
    
    </p>
    
    <hr>
    <pre>
    static const char *
    GetVersionFromFile(
        const char *filename,
        const char *match,
        int numdots)
    {
        size_t cbBuffer = 100;
        static char szBuffer[100];
        char *szResult = NULL;
        FILE *fp = fopen(filename, "rt");
    
        if (fp != NULL) {
    	/*
    	 * Read data until we see our match string.
    	 */
    
    	while (fgets(szBuffer, cbBuffer, fp) != NULL) {
    	    LPSTR p, q;
    
    	    p = strstr(szBuffer, match);
    	    if (p != NULL) {
    		/*
    		 * Skip to first digit after the match.
    		 */
    
    		p += strlen(match);
    		while (*p && !isdigit(*p)) {
    		    ++p;
    		}
    
    		/*
    		 * Find ending whitespace.
    		 */
    
    		q = p;
    		while (*q && (strchr("0123456789.ab", *q)) && ((!strchr(".ab", *q)
    			    && (!strchr("ab", q[-1])) || --numdots))) {
    		    ++q;
    		}
    
    		memcpy(szBuffer, p, q - p); // Bug is here
    		szBuffer[q-p] = 0;
    		szResult = szBuffer;
    		break;
    	    }
    	}
    	fclose(fp);
        }
        return szResult;
    }
    
    </pre>
    
  5. foundin changed to: "ALL"
  6. is_private changed to: "0"
  7. login: "salmonx"
  8. priority changed to: "5 Medium"
  9. private_contact changed to: "1e6726276a059d4157d886e633147205cbd8e399"
  10. resolution changed to: "None"
  11. severity changed to: "Important"
  12. status changed to: "Open"
  13. submitter changed to: "salmonx"
  14. subsystem changed to: "69. Other"
  15. title changed to:
    A stack overflow vulnerability in Tcl nmakehelp.c allows code execution via a crated file
    
  16. type changed to: "Bug"