about summary refs log tree commit diff stats
path: root/termbox/output.inl
diff options
context:
space:
mode:
Diffstat (limited to 'termbox/output.inl')
-rw-r--r--termbox/output.inl10
1 files changed, 5 insertions, 5 deletions
diff --git a/termbox/output.inl b/termbox/output.inl
index 277817fa..1ea4d810 100644
--- a/termbox/output.inl
+++ b/termbox/output.inl
@@ -166,7 +166,7 @@ static char *terminfo_try_path(const char *path, const char *term) {
   char tmp[4096];
   // snprintf guarantee for older compilers
   assert(sizeof(tmp) > sizeof(path)+sizeof("/x/")+sizeof(term)+1);
-  sprintf(tmp, "%s/%c/%s", path, term[0], term);
+  snprintf(tmp, sizeof(tmp), "%s/%c/%s", path, term[0], term);
   char *data = read_file(tmp);
   if (data) {
     return data;
@@ -174,7 +174,7 @@ static char *terminfo_try_path(const char *path, const char *term) {
 
   // fallback to darwin specific dirs structure
   // snprintf guarantee above still applies
-  sprintf(tmp, "%s/%x/%s", path, term[0], term);
+  snprintf(tmp, sizeof(tmp), "%s/%x/%s", path, term[0], term);
   return read_file(tmp);
 }
 
@@ -196,8 +196,8 @@ static char *load_terminfo(void) {
   if (home) {
     // snprintf guarantee for older compilers
     assert(sizeof(tmp) > sizeof(home)+sizeof("/.terminfo")+1);
-    strncpy(tmp, home, sizeof(tmp));
-    strcat(tmp, "/.terminfo");
+    strlcpy(tmp, home, sizeof(tmp));
+    strlcat(tmp, "/.terminfo", sizeof(tmp));
     char *data = terminfo_try_path(tmp, term);
     if (data)
       return data;
@@ -235,7 +235,7 @@ static const char *terminfo_copy_string(char *data, int str, int table) {
   const char *src = data + table + off;
   int len = strlen(src);
   char *dst = malloc(len+1);
-  strcpy(dst, src);
+  strlcpy(dst, src, len);
   return dst;
 }
 
on' href='/akkartik/mu/blame/003trace.test.cc?h=hlt&id=3dc3c72c4327f5f7cdeb28b1bb80cc8c67cb2c5b'>^
e9445310 ^

51530916 ^
35064671 ^

5af83346 ^
51530916 ^

5af83346 ^
35064671 ^

5af83346 ^
51530916 ^

5af83346 ^
35064671 ^
5af83346 ^
51530916 ^

d7494165 ^
35064671 ^
d7494165 ^


51530916 ^
35064671 ^


5af83346 ^
51530916 ^

51530916 ^
35064671 ^

51530916 ^



35064671 ^

51530916 ^


eba30983 ^
35064671 ^
4c569925 ^
eba30983 ^

51530916 ^

36594a43 ^
5f98a10c ^

36594a43 ^
5f98a10c ^
51530916 ^
51530916 ^




05d17773 ^
51530916 ^




05d17773 ^
51530916 ^




05d17773 ^

51530916 ^




05d17773 ^


51530916 ^




05d17773 ^


51530916 ^
d7494165 ^















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