Browse Source

[common] fix out-of-bounds read in li_sockaddr_to_string

Change-Id: I8984b6b170a43eb8c0f648c31957c5ae441cf93f
personal/stbuehler/wip
Stefan Bühler 6 years ago
parent
commit
811e13cfcd
  1. 7
      src/common/utils.c

7
src/common/utils.c

@ -629,7 +629,12 @@ GString *li_sockaddr_to_string(liSocketAddress addr, GString *dest, gboolean sho
else
g_string_truncate(dest, 0);
g_string_append_len(dest, CONST_STR_LEN("unix:"));
g_string_append(dest, saddr->un.sun_path);
{
const char* path_start = saddr->un.sun_path;
const char* path_end = ((const char*)saddr) + addr.len;
size_t path_len = path_end - path_start;
g_string_append_len(dest, path_start, strnlen(path_start, path_len));
}
break;
#endif
default:

Loading…
Cancel
Save