]> arthur.barton.de Git - netatalk.git/commitdiff
pipexlate, give up and return an error if it reachs the end of the output buffer
authordidg <didg>
Wed, 4 Feb 2009 22:33:11 +0000 (22:33 +0000)
committerdidg <didg>
Wed, 4 Feb 2009 22:33:11 +0000 (22:33 +0000)
config/AppleVolumes.default.tmpl
etc/papd/lp.c

index 903a5ac0f682b0a8fe73f4519f2d83805f567ec4..8a6f7c9eb7031e7c3f5631cbaae75d249913e338 100644 (file)
@@ -64,7 +64,6 @@
 #                       requested perm
 # fperm               -> default permission value for filesOR with the client 
 #                       requested perm
-
 #
 # miscellaneous options [syntax: options:option1,option2]:
 # prodos              -> make compatible with appleII clients.
index f5428f7ac733f767dea9d4389d421195599ae198..e36ba415ed8afb924b9461f27ac25f15169df184 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: lp.c,v 1.14.8.4.2.7 2009-02-03 08:25:00 didg Exp $
+ * $Id: lp.c,v 1.14.8.4.2.8 2009-02-04 22:33:11 didg Exp $
  *
  * Copyright (c) 1990,1994 Regents of The University of Michigan.
  * All Rights Reserved.  See COPYRIGHT.
@@ -296,6 +296,10 @@ static char* pipexlate(char *src)
             destlen -= len;
         }
     }
+    if (!destlen) {
+        /* reach end of buffer, maybe prematurely, give up */
+        return NULL;
+    }
     return destbuf;
 }
 
@@ -583,6 +587,11 @@ int lp_open( out, sat )
 
        lp_setup_comments(CH_UNIX);
        pipe_cmd = pipexlate(printer->p_printer);
+       if (!pipe_cmd) {
+           LOG(log_error, logtype_papd, "lp_open: can't generate pipe cmd" );
+           spoolerror( out, NULL );
+           return( -1 );
+       }
        if (( lp.lp_stream = popen(pipe_cmd, "w" )) == NULL ) {
            LOG(log_error, logtype_papd, "lp_open popen %s: %s", printer->p_printer, strerror(errno) );
            spoolerror( out, NULL );