Merge pull request #20 from jwilk/no-strcpy

Stopped copying arguments to fixed-size buffers
This commit is contained in:
Martin Lund 2016-05-08 12:57:07 +02:00
commit 5f4a836882
3 changed files with 5 additions and 5 deletions

View file

@ -30,9 +30,9 @@
/* Options */
struct option_t
{
char tty_device[MAXPATHLEN];
const char *tty_device;
bool log;
char log_filename[_POSIX_ARG_MAX];
const char *log_filename;
bool no_autoconnect;
int output_delay;
struct termios tio;

View file

@ -29,7 +29,7 @@
static FILE *fp;
static bool error = false;
void log_open(char *filename)
void log_open(const char *filename)
{
fp = fopen(filename, "w+");

View file

@ -314,7 +314,7 @@ void parse_options(int argc, char *argv[])
case 'l':
option.log = true;
strncpy(option.log_filename, optarg, _POSIX_ARG_MAX);
option.log_filename = optarg;
break;
case 'v':
@ -344,7 +344,7 @@ void parse_options(int argc, char *argv[])
/* Assume first non-option is the tty device name */
if (optind < argc)
strcpy(option.tty_device, argv[optind++]);
option.tty_device = argv[optind++];
if (strlen(option.tty_device) == 0)
{