summaryrefslogtreecommitdiff
path: root/lang
diff options
context:
space:
mode:
authordholland <dholland@pkgsrc.org>2015-06-25 07:52:13 +0000
committerdholland <dholland@pkgsrc.org>2015-06-25 07:52:13 +0000
commit60e81b2cd43f963ebb5e3b77698f8c29aa9cb2f0 (patch)
tree7d2927c1e85ddd00025ff8e73fdd3ab2c0c49547 /lang
parent041ec832a97787dc6c089ef2521f54f29c8fa118 (diff)
downloadpkgsrc-60e81b2cd43f963ebb5e3b77698f8c29aa9cb2f0.tar.gz
gets() considered harmful.
Diffstat (limited to 'lang')
-rw-r--r--lang/bwbasic/distinfo3
-rw-r--r--lang/bwbasic/patches/patch-renum.c52
2 files changed, 54 insertions, 1 deletions
diff --git a/lang/bwbasic/distinfo b/lang/bwbasic/distinfo
index 572506056ea..f5ae15f085e 100644
--- a/lang/bwbasic/distinfo
+++ b/lang/bwbasic/distinfo
@@ -1,7 +1,8 @@
-$NetBSD: distinfo,v 1.11 2015/05/20 07:28:05 wen Exp $
+$NetBSD: distinfo,v 1.12 2015/06/25 07:52:13 dholland Exp $
SHA1 (bwbasic-3.00.zip) = 89bb9e960bb91339752bb6d9796d93998d9ca3f6
RMD160 (bwbasic-3.00.zip) = 3d78b2fc3c6a73856b92443c296d71cd5b39208e
Size (bwbasic-3.00.zip) = 2777709 bytes
SHA1 (patch-aa) = ca4a5d62dc7aebfcace1df368cdc6ffbaa2c60da
SHA1 (patch-ac) = 1f8e3a3d6d75223abe2ceef63b5eb97a4b4cf4b4
+SHA1 (patch-renum.c) = 458affe1dd9742b54040b9721d2a8a7cfa82956b
diff --git a/lang/bwbasic/patches/patch-renum.c b/lang/bwbasic/patches/patch-renum.c
new file mode 100644
index 00000000000..79d1dd38bd7
--- /dev/null
+++ b/lang/bwbasic/patches/patch-renum.c
@@ -0,0 +1,52 @@
+$NetBSD: patch-renum.c,v 1.1 2015/06/25 07:52:13 dholland Exp $
+
+- don't use gets()
+
+--- renum.c~ 2015-01-21 03:55:10.000000000 +0000
++++ renum.c
+@@ -17,6 +17,18 @@ int f2, l2, n, x;
+ int sidx[1500][2];
+ char rstr[255];
+
++static void dogets(char *buf, size_t max)
++{
++ size_t len;
++
++ fgets(buf, max, stdin);
++ len = strlen(buf);
++ if (len > 0 && buf[len - 1] == '\n')
++ {
++ buf[len - 1] = '\0';
++ }
++}
++
+ main(argc, argv)
+ int argc;
+ char *argv[];
+@@ -34,7 +46,7 @@ main(argc, argv)
+ else
+ {
+ printf("Program in file? ");
+- gets(pstr);
++ dogets(pstr, sizeof(pstr));
+ }
+ if (strlen(pstr) == 0) strcpy(pstr, "0.doc");
+
+@@ -124,7 +136,7 @@ main(argc, argv)
+ skip = 0;
+ bp = 0;
+ printf("RENUMBER-");
+- gets(pstr);
++ dogets(pstr, sizeof(pstr));
+ p = strlen(pstr);
+
+ if (g == 0)
+@@ -268,7 +280,7 @@ main(argc, argv)
+ printf("%d -> %d\n", sidx[r][0], sidx[r][1]); */
+
+ printf("VERIFY? ");
+- gets(pstr);
++ dogets(pstr, sizeof(pstr));
+ v1 = 0;
+ if (strcmp(midstr2(pstr, 1, 1), "N") == 0) v1 = 1;
+