diff options
author | Edwin Groothuis <edwin@FreeBSD.org> | 2003-08-31 13:09:31 +0000 |
---|---|---|
committer | Edwin Groothuis <edwin@FreeBSD.org> | 2003-08-31 13:09:31 +0000 |
commit | 8a8b31d05cd02391ec25bd1600ee963651314cb2 (patch) | |
tree | 51f9d0c5cf9417d032d59d737d75e7aa133b785d /archivers/libcabinet/files/patch-listcap.cpp | |
parent | - New port mail/p5-Email-FolderType: Determine the type of a (diff) |
[patch] Unbreak port: archivers/libcabinet
This port did not build with gcc 3.3.1. I also fixed a
possible buffer overflow (they used gets() to read from
stdin).
Please review the patch file ``patch-cftypes.cpp'' with
extra care, since I am not sure whether this makes sense
(2 positions in the file, marked with ``TODO'' - thanks.
Also added some lines in cftypes.cpp to overcome the absence of
values.h on -current.
PR: ports/55767
Submitted by: Simon Barner <barner@in.tum.de>
Notes
Notes:
svn path=/head/; revision=88198
Diffstat (limited to '')
-rw-r--r-- | archivers/libcabinet/files/patch-listcap.cpp | 42 |
1 files changed, 42 insertions, 0 deletions
diff --git a/archivers/libcabinet/files/patch-listcap.cpp b/archivers/libcabinet/files/patch-listcap.cpp new file mode 100644 index 000000000000..409e1f6c0e58 --- /dev/null +++ b/archivers/libcabinet/files/patch-listcap.cpp @@ -0,0 +1,42 @@ +--- listcab.cpp.orig Tue Aug 19 20:42:27 2003 ++++ listcab.cpp Tue Aug 19 20:49:27 2003 +@@ -47,13 +47,19 @@ + cerr << "New Folder Error: " << retval << endl; + return 1; + } +- ++ int n; + do{ + cout << "Enter filename: "; +- gets(filename); +- +- if(strlen(filename) > 0) ++ fgets(filename, 256, stdin); ++ n = strlen (filename); ++ ++ if (n == 1 && filename[0] == '\n') ++ n = 0; ++ ++ if(n > 0) + { ++ if (filename[n-1] == '\n') ++ filename[n-1] = '\0'; + if((retval = cab.add_file(filename)) != OK) + { + perror("read"); +@@ -62,10 +68,13 @@ + return 1; + } + } +- }while(strlen(filename) > 0); ++ }while(n > 0); + + cout << "Enter filename for cabinet: "; +- gets(filename); ++ fgets(filename, 256, stdin); ++ n = strlen (filename); ++ if (n > 0 && filename[n-1] == '\n') ++ filename[n-1] = '\0'; + + if((retval = cab.close(filename)) != OK) + { |