diff options
author | defanor <defanor@uberspace.net> | 2023-09-29 20:24:16 +0300 |
---|---|---|
committer | defanor <defanor@uberspace.net> | 2023-09-29 20:24:16 +0300 |
commit | ccdb748c81abc9bb30b8989e27d22bbbb219f9a0 (patch) | |
tree | 295be2ea605c8acbe56116ea3ce119b99e3e0440 /src/rexmpp_jid.c | |
parent | 04e6fd5194481798bc30abc7a690664d5af36aeb (diff) |
Add more checks, tests, and documentation
Diffstat (limited to 'src/rexmpp_jid.c')
-rw-r--r-- | src/rexmpp_jid.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/src/rexmpp_jid.c b/src/rexmpp_jid.c index 522a492..f1c371c 100644 --- a/src/rexmpp_jid.c +++ b/src/rexmpp_jid.c @@ -64,8 +64,10 @@ int rexmpp_jid_parse (const char *str, struct rexmpp_jid *jid) { jid->local[local_len] = '\0'; strncpy(jid->domain, domain, domain_len); jid->domain[domain_len] = '\0'; - strncpy(jid->resource, resource, resource_len); - jid->resource[resource_len] = '\0'; + if (resource != NULL) { + strncpy(jid->resource, resource, resource_len); + jid->resource[resource_len] = '\0'; + } return 0; } |