]> arthur.barton.de Git - netatalk.git/commitdiff
papd better parsing of postscript requests
authordidg <didg>
Mon, 2 Feb 2009 16:04:33 +0000 (16:04 +0000)
committerdidg <didg>
Mon, 2 Feb 2009 16:04:33 +0000 (16:04 +0000)
etc/papd/auth.c
etc/papd/magics.c
etc/papd/queries.c

index 9ce22acc09109b6c229d1beef0c99752d61eb65b..560f2b013c59f6821a4c2bce3089e862ba551ef2 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: auth.c,v 1.7 2005-04-28 20:49:49 bfernhomberg Exp $
+ * $Id: auth.c,v 1.8 2009-02-02 16:04:33 didg Exp $
  *
  * Copyright (c) 1990,1993 Regents of The University of Michigan.
  * All Rights Reserved.  See COPYRIGHT.
@@ -99,7 +99,7 @@ int auth_load(const char *path, const char *list)
   char name[MAXPATHLEN + 1], buf[MAXPATHLEN + 1], *p; 
   struct uam_mod *mod;
   struct stat st;
-  int len;
+  size_t len;
   
   if (!path || !list || (len = strlen(path)) > sizeof(name) - 2)
     return -1;
index bc0b70b58e53dd074d1c39b1aa4faba1d3925218..29a61543d666e2b1a0bb8acdada45c90546aad41 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: magics.c,v 1.13 2009-02-02 10:31:32 didg Exp $
+ * $Id: magics.c,v 1.14 2009-02-02 16:04:33 didg Exp $
  *
  * Copyright (c) 1990,1994 Regents of The University of Michigan.
  * All Rights Reserved.  See COPYRIGHT.
@@ -216,7 +216,7 @@ int cm_psswitch( in, out, sat )
        }
     }
 
-    if ( stop - p >= strlen( Query ) &&
+    if ( (size_t)(stop - p) >= strlen( Query ) &&
            strncmp( p, Query, strlen( Query )) == 0 ) {
        if ( comswitch( magics, cm_psquery ) < 0 ) {
            LOG(log_error, logtype_papd, "cm_psswitch: can't find psquery!" );
index 658caa02a87f8baf9612aec6d83ff8351cd92f4a..c698c2b4fcb937f1117708467580b2f4b0bbc5c2 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: queries.c,v 1.20 2009-02-02 12:46:45 didg Exp $
+ * $Id: queries.c,v 1.21 2009-02-02 16:04:33 didg Exp $
  *
  * Copyright (c) 1990,1994 Regents of The University of Michigan.
  * All Rights Reserved.  See COPYRIGHT.
@@ -94,9 +94,11 @@ int cq_default( in, out )
                        break;
                    }
                }
-               p++;
-               while ( *p == ' ' ) {
+               if (p < stop) {
                    p++;
+                   while ( *p == ' ' ) {
+                       p++;
+                    }
                }
 
                append( out, p, stop - p + crlflength );
@@ -145,6 +147,7 @@ int cq_k4login( in, out )
 
     bzero( &tkt, sizeof( tkt ));
     stop = start+linelength;
+    /* FIXME */
     for ( i = 0, t = tkt.dat; p < stop; p += 2, t++, i++ ) {
        *t = ( h2b( (unsigned char)*p ) << 4 ) +
                h2b( (unsigned char)*( p + 1 ));
@@ -351,7 +354,7 @@ int cq_query( in, out )
                }
            }
 
-           for ( p++; p < stop; p++ ) {
+           if (p < stop) for ( p++; p < stop; p++ ) {
                if ( *p != ' ' && *p != '\t' ) {
                    break;
                }
@@ -364,7 +367,7 @@ int cq_query( in, out )
            }
 
            for ( gq = genqueries; gq->gq_name; gq++ ) {
-               if (( strlen( gq->gq_name ) == q - p ) &&
+               if (( strlen( gq->gq_name ) == (size_t)(q - p) ) &&
                        ( strncmp( gq->gq_name, p, q - p ) == 0 )) {
                    break;
                }
@@ -457,7 +460,8 @@ int cq_font( in, out )
                    break;
                }
            }
-           p++;
+           if (p < stop)
+               p++;
 
            cq_font_answer( p, stop, out );
        } else {
@@ -470,7 +474,8 @@ int cq_font( in, out )
                        break;
                    }
                }
-               p++;
+               if (p < stop)
+                   p++;
 
                cq_font_answer( p, stop, out );
            } else {
@@ -519,7 +524,8 @@ int cq_feature( in, out )
                    break;
                }
            }
-           p++;
+           if (p < stop)
+               p++;
            while ( *p == ' ' ) {
                p++;
            }