Sophie

Sophie

distrib > Mageia > 2 > i586 > media > core-release-src > by-pkgid > 3d1df2fc5448ac26acf7770f78720b8e > files > 1

antiword-0.37-8.mga2.src.rpm

#! /bin/sh /usr/share/dpatch/dpatch-run
## 10_fix_buffer_overflow_wordole_c.dpatch by  <eriks@debian.org>
##
## All lines beginning with `## DP:' are a description of the patch.
## DP: Add check for buffer overflow with malformed input files
## DP: Closes: #407015

@DPATCH@
diff -urNad antiword-0.37~/wordole.c antiword-0.37/wordole.c
--- antiword-0.37~/wordole.c	2005-08-26 21:49:57.000000000 +0200
+++ antiword-0.37/wordole.c	2009-06-03 22:31:15.948014682 +0200
@@ -259,6 +259,10 @@
 		}
 		tNameSize = (size_t)usGetWord(0x40, aucBytes);
 		tNameSize = (tNameSize + 1) / 2;
+		if ( tNameSize > sizeof(atPPSlist[iIndex].szName)) {
+			werr(0, "Name Size of PPS %d is too large", iIndex);
+			tNameSize = sizeof(atPPSlist[iIndex].szName);
+		}
 		vName2String(atPPSlist[iIndex].szName, aucBytes, tNameSize);
 		atPPSlist[iIndex].ucType = ucGetByte(0x42, aucBytes);
 		if (atPPSlist[iIndex].ucType == 5) {