From: didg Date: Wed, 21 Jan 2009 02:42:56 +0000 (+0000) Subject: better handling of bogus ppd files X-Git-Tag: before_acls~18 X-Git-Url: https://arthur.barton.de/cgi-bin/gitweb.cgi?p=netatalk.git;a=commitdiff_plain;h=305c46c79b79ed0280e0421317bb042387f569ec better handling of bogus ppd files --- diff --git a/etc/papd/ppd.c b/etc/papd/ppd.c index 4e30e1b4..bde0ec0f 100644 --- a/etc/papd/ppd.c +++ b/etc/papd/ppd.c @@ -1,5 +1,5 @@ /* - * $Id: ppd.c,v 1.12 2009-01-15 22:01:26 morgana Exp $ + * $Id: ppd.c,v 1.13 2009-01-21 02:42:56 didg Exp $ * * Copyright (c) 1995 Regents of The University of Michigan. * All Rights Reserved. See COPYRIGHT. @@ -93,7 +93,7 @@ static char* my_fgets(buf, bufsize, stream) return buf; } -struct ppdent *getppdent( stream ) +static struct ppdent *getppdent( stream ) FILE *stream; { static char buf[ 1024 ]; @@ -107,7 +107,7 @@ struct ppdent *getppdent( stream ) if ( *p != '*' ) { /* main key word */ continue; } - if ( p[ strlen( p ) - 1 ] != '\n' && p[ strlen( p ) - 1 ] != '\r') { + if ( p[ strlen( p ) - 1 ] != '\n') { LOG(log_error, logtype_papd, "getppdent: line too long" ); continue; } @@ -205,7 +205,7 @@ int read_ppd( file, fcnt ) } /* *Font */ - if ( strcmp( pe->pe_main, "*Font" ) == 0 ) { + if ( strcmp( pe->pe_main, "*Font" ) == 0 && pe->pe_option ) { for ( pfo = ppd_fonts; pfo; pfo = pfo->pd_next ) { if ( strcmp( pfo->pd_font, pe->pe_option ) == 0 ) { break; @@ -238,7 +238,7 @@ int read_ppd( file, fcnt ) break; } } - if ( pfe->pd_name ) { /*&& (pfe->pd_value == NULL) ) { */ + if ( pfe->pd_name && pe->pe_value ) { if (( pfe->pd_value = (char *)malloc( strlen( pe->pe_value ) + 1 )) == NULL ) { LOG(log_error, logtype_papd, "malloc: %s", strerror(errno) );