]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Changed gets() call to fgets() to avoid possible (but extremely unlikely)
authormike <mike@7a7537e8-13f0-0310-91df-b6672ffda945>
Mon, 21 Jun 1999 19:10:07 +0000 (19:10 +0000)
committermike <mike@7a7537e8-13f0-0310-91df-b6672ffda945>
Mon, 21 Jun 1999 19:10:07 +0000 (19:10 +0000)
problems due to buffer overrun.

git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/trunk@428 7a7537e8-13f0-0310-91df-b6672ffda945

berkeley/lpc.c

index 6a0365dd8950ad8a66fe3462d98b25f0e543d795..79e369f98b17e7455701e8897a4feb811cd23399 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$Id: lpc.c,v 1.2 1999/06/09 20:03:47 mike Exp $"
+ * "$Id: lpc.c,v 1.3 1999/06/21 19:10:07 mike Exp $"
  *
  *   "lpc" command for the Common UNIX Printing System (CUPS).
  *
@@ -87,8 +87,14 @@ main(int  argc,              /* I - Number of command-line arguments */
     */
 
     printf("lpc> ");
-    while (gets(line) != NULL)
+    while (fgets(line, sizeof(line), stdin) != NULL)
     {
+     /*
+      * Strip the trailing newline...
+      */
+
+      line[strlen(line) - 1] = '\0';
+
      /*
       * Find any options in the string...
       */
@@ -448,5 +454,5 @@ show_status(http_t *http,   /* I - HTTP connection to server */
 
 
 /*
- * End of "$Id: lpc.c,v 1.2 1999/06/09 20:03:47 mike Exp $".
+ * End of "$Id: lpc.c,v 1.3 1999/06/21 19:10:07 mike Exp $".
  */