about summary refs log tree commit diff
diff options
context:
space:
mode:
-rw-r--r--converter/pbm/pktopbm.c5
-rw-r--r--doc/HISTORY3
2 files changed, 7 insertions, 1 deletions
diff --git a/converter/pbm/pktopbm.c b/converter/pbm/pktopbm.c
index a3584ee5..712f339f 100644
--- a/converter/pbm/pktopbm.c
+++ b/converter/pbm/pktopbm.c
@@ -214,7 +214,10 @@ main(int argc, char *argv[]) {
 
     if (--argc < 1) pm_usage(usage) ;
 
-    strcpy(pkname, *++argv) ;
+    ++argv;
+    if(strlen(*argv) + 4 > NAMELENGTH)
+        pm_error("pkname is too long");
+    strcpy(pkname, *argv) ;
     pktopbm_add_suffix(pkname, ".pk") ;
 
     car = 0 ;
diff --git a/doc/HISTORY b/doc/HISTORY
index abcb421e..d1c6ff71 100644
--- a/doc/HISTORY
+++ b/doc/HISTORY
@@ -32,6 +32,9 @@ not yet  BJH  Release 10.71.00
               pbmtopk: Fix buffer overrun with long file name.  Always
               present.  (pbmtopk was new in Netpbm 1 (March 1991)).
 
+              pktopbm: Fix buffer overrun with long file name.  Always
+              present.  (pbmtopk was new in Netpbm 1 (March 1991)).
+
               pbmtopi3: Fix bug: wrong output when input is higher or wider
               than 640 pixels.  Always broken (pbmtopi3 was new in September
               1991).