You know both lengths, you might as well use xmemdup() for both.

In other words, you know both are null terminated so you might as well use xstrdup() for both. Your choice. :-)