403Webshell
Server IP : 82.208.35.60  /  Your IP : 216.73.216.238
Web Server : Apache/2.4.55 (FreeBSD) OpenSSL/1.1.1q-freebsd PHP/7.3.31
System : FreeBSD server7.d2m.cz 12.4-RELEASE-p9 FreeBSD 12.4-RELEASE-p9 GENERIC amd64
User : studiokobylisy_cz ( 1008)
PHP Version : 7.3.31
Disable Function : NONE
MySQL : OFF  |  cURL : ON  |  WGET : OFF  |  Perl : OFF  |  Python : OFF  |  Sudo : OFF  |  Pkexec : OFF
Directory :  /usr/ports/math/prng/files/

Upload File :
current_dir [ Writeable ] document_root [ Writeable ]

 

Command :


[ Back ]     

Current File : /usr/ports/math/prng/files/patch-no-gets
--- examples/pairs.c.orig	2019-06-30 22:57:59.603524000 +0300
+++ examples/pairs.c	2019-06-30 23:06:55.659597000 +0300
@@ -54,6 +54,18 @@
 #include <string.h>
 #include "prng.h"
 
+static void
+safe_gets(char *buf, int size)
+{
+	size_t len;
+
+	if (fgets(buf, size, stdin) == NULL)
+		return;
+	len = strlen(buf);
+	if (len && buf[len - 1] == '\n')
+		buf[len - 1] = '\0';
+}
+
 struct prng_struct *generator;
 char outfile[200] = "pairs.out";
 FILE *out;
@@ -71,7 +83,7 @@
 else
 	{
 	printf("\nGenerator ? ");
-	gets(input);
+	safe_gets(input, sizeof(input));
 	g = prng_new(input);
 	}
 
@@ -88,7 +100,7 @@
  	{
 	npairs = 10000;
 	printf("\nHow many pairs [%d] ",npairs);
-	gets(input);
+	safe_gets(input, sizeof(input));
 	if (input[0] != 0 ) npairs = atoi(input);
 	}
 
@@ -97,7 +109,7 @@
 else
 	{
 	printf("Output filename ('-' for stdout) ? [%s] ",outfile);
-	gets(input);
+	safe_gets(input, sizeof(input));
 	if (input[0] != 0 ) strncpy(outfile,input,100);
 	}
 

Youez - 2016 - github.com/yon3zu
LinuXploit