*
* You should have received a copy of the GNU General Public License
* along with this program; if not, write to the Free Software
- * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
*/
#include <config.h>
CharMetricInfo *cm;
FILE *in;
- in = fopen(filename, "r");
+ in = fopen(filename, "rb");
if(in == NULL)
return -1;
status = afm_parse_file(in, &fi, P_GM);
Int32 *depths;
Uint32 checksum;
- in = fopen(filename, "r");
+ in = fopen(filename, "rb");
if(in == NULL)
return -1;
tfm = NULL;
/* We read the entire TFM file into core */
if(fstat(fileno(in), &st) < 0)
return -1;
- if(st.st_size == 0)
+ /* according to the spec, TFM files are smaller than 16K */
+ if(st.st_size == 0 || st.st_size >= 16384)
goto bad_tfm;
/* allocate a word-aligned buffer to hold the file */
int olevel;
int nwords;
- in = fopen(filename, "r");
+ in = fopen(filename, "rb");
if(in == NULL)
return -1;