<i>A format string vulnerability in Tcl nmakehelp.c allows code execution via a crated file.</i>.
by
.
D 2021-06-22T07:33:42.185
J assignee nobody
J closer nobody
J cmimetype text/html
J comment <p>Description:\sThe\s'printf'\sin\s'SubstituteFile'\saccepts\sa\sformat\sstring\sas\san\sargument,\sbut\sthe\sformat\sstring\soriginates\sfrom\sthe\sargv[3]\swhich\sis\scontrolled\sby\suser.\r\n</p>\r\n<p>Fix:\sprintf("%s",\sszBuffer);</p>\r\n\r\n<hr>\r\n<pre>\r\nstatic\sint\r\nSubstituteFile(\r\n\s\s\s\sconst\schar\s*substitutions,\r\n\s\s\s\sconst\schar\s*filename)\r\n{\r\n\s\s\s\s...\r\n\r\n\t/*\r\n\t\s*\sRun\sthe\ssubstitutions\sover\seach\sline\sof\sthe\sinput\r\n\t\s*/\r\n\r\n\twhile\s(fgets(szBuffer,\scbBuffer,\sfp)\s!=\sNULL)\s{\r\n\t\s\s\s\slist_item_t\s*p\s=\sNULL;\r\n\t\s\s\s\sfor\s(p\s=\ssubstPtr;\sp\s!=\sNULL;\sp\s=\sp->nextPtr)\s{\r\n\t\tchar\s*m\s=\sstrstr(szBuffer,\sp->key);\r\n\t\tif\s(m)\s{\r\n\t\t\s\s\s\schar\s*cp,\s*op,\s*sp;\r\n\t\t\s\s\s\scp\s=\sszCopy;\r\n\t\t\s\s\s\sop\s=\sszBuffer;\r\n\t\t\s\s\s\swhile\s(op\s!=\sm)\s*cp++\s=\s*op++;\r\n\t\t\s\s\s\ssp\s=\sp->value;\r\n\t\t\s\s\s\swhile\s(sp\s&&\s*sp)\s*cp++\s=\s*sp++;\r\n\t\t\s\s\s\sop\s+=\sstrlen(p->key);\r\n\t\t\s\s\s\swhile\s(*op)\s*cp++\s=\s*op++;\r\n\t\t\s\s\s\s*cp\s=\s0;\r\n\t\t\s\s\s\smemcpy(szBuffer,\sszCopy,\ssizeof(szCopy));\r\n\t\t}\r\n\t\s\s\s\s}\r\n\t\s\s\s\sprintf(szBuffer);\s//\sBug\sis\shere,\sszBuffer\scan\sbe\scontrolled\r\n\t}\r\n\r\n\tlist_free(&substPtr);\r\n\s\s\s\s}\r\n\s\s\s\sfclose(fp);\r\n\s\s\s\sreturn\s0;\r\n}\r\n</pre>
J foundin ALL
J is_private 0
J login salmonx
J priority 5\sMedium
J private_contact 1e6726276a059d4157d886e633147205cbd8e399
J resolution None
J severity Important
J status Open
J submitter salmonx
J subsystem 69.\sOther
J title A\sformat\sstring\svulnerability\sin\sTcl\snmakehelp.c\sallows\scode\sexecution\svia\sa\scrated\sfile.
J type Bug
K bad6cc213dfe8280c25b3bfe3e5830e9e2481f91
U salmonx
Z 23718ce3381d64f8126f8db3aa0a497e