]> arthur.barton.de Git - netatalk.git/commitdiff
better handling of bogus ppd files
authordidg <didg>
Wed, 21 Jan 2009 02:32:16 +0000 (02:32 +0000)
committerdidg <didg>
Wed, 21 Jan 2009 02:32:16 +0000 (02:32 +0000)
etc/papd/ppd.c

index 2e1cf86cd2ffcad4aed8207e5c592a749f1895fa..222428848b333cc4820daa43548178dcf0142bf4 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: ppd.c,v 1.9.8.1.2.4 2009-01-19 02:23:16 didg Exp $
+ * $Id: ppd.c,v 1.9.8.1.2.5 2009-01-21 02:32:16 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) );