Closed fcambus closed 4 years ago
This issue has been assigned CVE-2019-19601.
A few comments: first of all, this bug happens in the code path where kpathsea is not used (#ifndef KPATHSEA
), thus, when compiled with kpathsea which is probably mostly used there is no problem. For example, those using detex from the TeX Live sources and build in the usual way, that is with kpathsea, will not be affected.
For a fix, Akira Kakuto from the TeX Live team suggested:
--- detex.l.orig Sun Feb 03 19:49:09 2019
+++ detex.l Thu Jan 23 11:23:50 2020
@@ -898,10 +898,10 @@
#else
if (*sbFile == '/') { /* absolute path */
#endif
- (void)sprintf(sbFullPath, "%s", sbFile);
+ (void)snprintf(sbFullPath, PATH_MAX-1, "%s", sbFile);
iPath = csbInputPaths; /* only check once */
} else
- (void)sprintf(sbFullPath, "%s/%s", rgsbInputPaths[iPath], sbFile);
+ (void)snprintf(sbFullPath, PATH_MAX-1, "%s/%s", rgsbInputPaths[iPath], sbFile);
#ifdef OS2
pch = sbFullPath;
while (pch = strchr(pch, '\\'))
but this is unchecked.
Hope that helps.
Hi,
While fuzzing OpenDetex with Honggfuzz, I found a buffer overflow in the TexOpen() function, in detex.l.
Attaching a reproducer (gzipped so GitHub accepts it): test01.gz
Issue can be reproduced by running: