[server] correct usage of g_strndup

  - g_strndup will always allocate a n+1 bytes string, and terminate it by NULL.
  - there is no need for manually doing this.
  - see more at glib's source (glib/gstrfuncs.c)
  - see more at glib's document
    https://developer.gnome.org/glib/2.28/glib-String-Utility-Functions.html