#include <stdio.h>
#include "portable_io.h"



char Prbuf[MAXLLEN];

//将输入输出函数包出来.

void portable_puts(char* buf){
	while((*buf)!=0){
		putchar(*buf);
		buf++;
	}
}

void portable_input_int(int* val){
	portable_gets(Prbuf); 
	sscanf(Prbuf, "%d", val);
}

void portable_gets(char* buf){
	gets(buf);	
} 

#include <stdio.h>
#include "portable_io.h"



char Prbuf[MAXLLEN];

//将输入输出函数包出来.

void portable_puts(char* buf){
	while((*buf)!=0){
		putchar(*buf);
		buf++;
	}
}

void portable_input_int(int* val){
	portable_gets(Prbuf); 
	sscanf(Prbuf, "%d", val);
}

void portable_gets(char* buf){
	fgets(buf, MAXLLEN, stdin);	
} 

Change gets to fgets, because gets is unsafe
Change gets to fgets, because gets is unsafe

We had to make a pull request to a project with some unsafe C code to make it more secure. This project was the lucky one. Have fun with the security improvements :)