summaryrefslogtreecommitdiffstats
path: root/ax25ipd/config.c
diff options
context:
space:
mode:
authorThomas Osterried <thomas@osterried.de>2009-01-31 21:25:45 +0000
committerThomas Osterried <thomas@osterried.de>2009-01-31 21:25:45 +0000
commit22a123ac402e7786ab4472c561a9e9a21cd21567 (patch)
tree93dca5647018137738c8eadbe82d0505829e342f /ax25ipd/config.c
parenta6ccc8055fd0caa1406fd098dfe9e2f522d2dad2 (diff)
Better integration in unix98 PTY environments.
Revised the getopt_long() part. Assured strcpy cases. Thanks to Christoph <dk2crn> for contribution.
Diffstat (limited to 'ax25ipd/config.c')
-rw-r--r--ax25ipd/config.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/ax25ipd/config.c b/ax25ipd/config.c
index 4c1db85..e6ae790 100644
--- a/ax25ipd/config.c
+++ b/ax25ipd/config.c
@@ -205,10 +205,17 @@ char *buf;
return 0;
} else if (strcmp(p, "device") == 0) {
+ /* already set? i.e. with commandline option, which overwrites
+ * the preconfigured setting. useful for systems with unix98
+ * style pty's
+ */
+ if (*ttydevice)
+ return 0;
q = strtok(NULL, " \t\n\r");
if (q == NULL)
return -1;
- strcpy(ttydevice, q);
+ strncpy(ttydevice, q, sizeof(ttydevice)-1);
+ ttydevice[sizeof(ttydevice)-1] = 0;
return 0;
} else if (strcmp(p, "mode") == 0) {
@@ -272,10 +279,11 @@ char *buf;
q = p + strlen(p) + 1;
if (strlen(q) < 2)
return -1; /* line ends with a \n */
- if (strlen(q) > sizeof bc_text)
+ if (strlen(q) > sizeof(bc_text))
return -7;
q[strlen(q) - 1] = '\0';
- strcpy(bc_text, q);
+ strncpy(bc_text, q, sizeof(bc_text)-1);
+ bc_text[sizeof(bc_text)-1] = 0;
return 0;
} else if (strcmp(p, "loglevel") == 0) {