*/
 #define BPF_MAX_VAR_SIZ        (1 << 29)
 /* size of type_str_buf in bpf_verifier. */
-#define TYPE_STR_BUF_LEN 64
+#define TYPE_STR_BUF_LEN 128
 
 /* Liveness marks, used for registers and spilled-regs (in stack slots).
  * Read marks propagate upwards until they find a write mark; they record that
 
 static const char *reg_type_str(struct bpf_verifier_env *env,
                                enum bpf_reg_type type)
 {
-       char postfix[16] = {0}, prefix[32] = {0};
+       char postfix[16] = {0}, prefix[64] = {0};
        static const char * const str[] = {
                [NOT_INIT]              = "?",
                [SCALAR_VALUE]          = "scalar",
                        strncpy(postfix, "_or_null", 16);
        }
 
-       if (type & MEM_RDONLY)
-               strncpy(prefix, "rdonly_", 32);
-       if (type & MEM_RINGBUF)
-               strncpy(prefix, "ringbuf_", 32);
-       if (type & MEM_USER)
-               strncpy(prefix, "user_", 32);
-       if (type & MEM_PERCPU)
-               strncpy(prefix, "percpu_", 32);
-       if (type & PTR_UNTRUSTED)
-               strncpy(prefix, "untrusted_", 32);
+       snprintf(prefix, sizeof(prefix), "%s%s%s%s%s",
+                type & MEM_RDONLY ? "rdonly_" : "",
+                type & MEM_RINGBUF ? "ringbuf_" : "",
+                type & MEM_USER ? "user_" : "",
+                type & MEM_PERCPU ? "percpu_" : "",
+                type & PTR_UNTRUSTED ? "untrusted_" : ""
+       );
 
        snprintf(env->type_str_buf, TYPE_STR_BUF_LEN, "%s%s%s",
                 prefix, str[base_type(type)], postfix);