[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](https://github.com/GNOME/glib/blob/master/glib/gstrfuncs.c#L393)
  * see more at glib's document
    https://developer.gnome.org/glib/2.28/glib-String-Utility-Functions.html