about summary refs log tree commit diff stats
path: root/termbox/output.inl
diff options
context:
space:
mode:
authorKartik K. Agaram <vc@akkartik.com>2016-10-05 23:34:53 -0700
committerKartik K. Agaram <vc@akkartik.com>2016-10-05 23:34:53 -0700
commitd4ecd588afffccd8184f1ff70e7d13c72c38c7d5 (patch)
tree60c145b86e14cd918368ff09226724d1bb557d44 /termbox/output.inl
parent159359029603044014a62c26b63a60b17547400e (diff)
downloadmu-d4ecd588afffccd8184f1ff70e7d13c72c38c7d5.tar.gz
3443
Fix some OpenBSD warnings.
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;
 }