1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
|
--- Wnn/uum/jhlp.c.orig Thu Mar 9 16:34:56 2000
+++ Wnn/uum/jhlp.c Thu Mar 9 16:44:26 2000
@@ -80,6 +80,9 @@
jmp_buf kk_env;
+#if (defined(__unix__) || defined(unix)) && !defined(USG)
+#include <sys/param.h>
+#endif
#ifdef SYSVR2
# include <sys/param.h>
#endif /* SYSVR2 */
@@ -168,12 +171,14 @@
strcpy(username, getpwuid(getuid())->pw_name);
if((name = getenv(WNN_USERNAME_ENV)) != NULL){
- strcpy(username, name);
+ strncpy(username, name, PATHNAMELEN - 1);
+ username[PATHNAMELEN - 1] = '\0';
}
for (i = 1; i < argc;) {
if (!strcmp(argv[i++], "-L")) {
if (i >= argc || argv[i][0] == '-') default_usage();
- strcpy(lang_dir, argv[i++]);
+ strncpy(lang_dir, argv[i++], 31);
+ lang_dir[31] = '\0';
for (;i < argc; i++) {
argv[i - 2] = argv[i];
}
@@ -233,8 +238,9 @@
server_env = WNN_DEF_SERVER_ENV;
}
if(name = getenv(server_env)) {
- strcpy(def_servername, name);
- strcpy(def_reverse_servername, name);
+ strncpy(def_servername, name, PATHNAMELEN - 1);
+ def_servername[PATHNAMELEN - 1] = '\0';
+ strcpy(def_reverse_servername, def_servername);
}
}
@@ -263,9 +269,11 @@
#if defined(BSD42) && !defined(DGUX)
+#if !(defined(BSD) && (BSD >= 199306))
if (saveutmp() < 0) {
puts("Can't save utmp\n");
}
+#endif
#endif /* BSD42 */
@@ -492,7 +500,8 @@
static int do_k_opt()
{
- strcpy(uumkey_name_in_uumrc, optarg);
+ strncpy(uumkey_name_in_uumrc, optarg, PATHNAMELEN - 1);
+ uumkey_name_in_uumrc[PATHNAMELEN - 1] = '\0';
if (*uumkey_name_in_uumrc == '\0') {
return -1;
}
@@ -502,7 +511,8 @@
static int do_c_opt()
{
- strcpy(convkey_name_in_uumrc, optarg);
+ strncpy(convkey_name_in_uumrc, optarg, PATHNAMELEN - 1);
+ convkey_name_in_uumrc[PATHNAMELEN - 1] = '\0';
if (*convkey_name_in_uumrc == '\0') {
return -1;
}
@@ -512,7 +522,8 @@
static int do_r_opt()
{
- strcpy(rkfile_name_in_uumrc, optarg);
+ strncpy(rkfile_name_in_uumrc, optarg, PATHNAMELEN - 1);
+ rkfile_name_in_uumrc[PATHNAMELEN - 1] = '\0';
if (*rkfile_name_in_uumrc == '\0') {
return -1;
}
@@ -528,8 +539,9 @@
static int do_D_opt()
{
- strcpy(def_servername, optarg);
- strcpy(def_reverse_servername, optarg);
+ strncpy(def_servername, optarg, PATHNAMELEN - 1);
+ def_servername[PATHNAMELEN - 1] = '\0';
+ strcpy(def_reverse_servername, def_servername);
if (*def_servername == '\0') {
return -1;
}
@@ -538,7 +550,8 @@
static int do_n_opt()
{
- strcpy(username, optarg);
+ strncpy(username, optarg, PATHNAMELEN - 1);
+ username[PATHNAMELEN - 1] = '\0';
if (*username == '\0') {
return -1;
}
@@ -771,7 +784,12 @@
#endif
int pid;
- if ((pid = wait3(&status, WNOHANG | WUNTRACED, NULL)) == child_id) {
+/*
+ * Remove warning.
+ * Patched by Hidekazu Kuroki(hidekazu@cs.titech.ac.jp) 1996/8/20
+ */
+/* if ((pid = wait3(&status, WNOHANG | WUNTRACED, NULL)) == child_id) { */
+ if ((pid = wait3((int *)&status, WNOHANG | WUNTRACED, NULL)) == child_id) {
if (WIFSTOPPED(status)) {
#ifdef SIGCONT
kill(pid, SIGCONT);
@@ -1140,9 +1158,11 @@
setpgrp(0, pid);
#endif /* BSD42 */
+#if !(defined(BSD) && (BSD >= 199306))
if (setutmp(ttypfd) == ERROR) {
puts("Can't set utmp.");
}
+#endif
#ifdef linux
setsid();
@@ -1562,9 +1582,11 @@
perror(prog);
}
+#if !(defined(BSD) && (BSD >= 199306))
if (resetutmp(ttypfd) == ERROR) {
printf("Can't reset utmp.");
}
+#endif
#ifdef TIOCSSIZE
pty_rowcol.ts_lines = 0;
pty_rowcol.ts_cols = 0;
@@ -1636,7 +1658,16 @@
char *b, *pty;
int no;
{
+/*
+ * Change pseudo-devices.
+ * Because FreeBSD's master pseudo-devices are pty[p-sP-S][0-9a-v].
+ * Patched by Hidekazu Kuroki(hidekazu@cs.titech.ac.jp) 1996/8/20
+ */
+#if (defined(BSD) && (BSD >= 199306)) /* 4.4BSD-Lite by Taoka */
+ sprintf(b, "%s%1c%1c", pty, "pqrsPQRS"[(no >> 5)], ((no & 0x1f > 9)? 'a' : '0') + (no & 0x1f));
+#else /* ! 4.4BSD-Lite */
sprintf(b, "%s%1c%1x", pty, 'p' + (no >> 4), no & 0x0f);
+#endif /* ! 4.4BSD-Lite */
}
#endif /* !sgi */
|