aboutsummaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorMartin Schanzenbach <schanzen@gnunet.org>2022-03-05 08:58:51 +0100
committerMartin Schanzenbach <schanzen@gnunet.org>2022-03-05 08:58:51 +0100
commit2087b149d9a63eac15bbe9f03b0550d17d83eedb (patch)
tree35b45c203b74f53ce1ea0d4f03604f6c76b691bf /src
parent343177a0bcd25dea2ff651d847fb700a584300f3 (diff)
downloadgnunet-2087b149d9a63eac15bbe9f03b0550d17d83eedb.tar.gz
gnunet-2087b149d9a63eac15bbe9f03b0550d17d83eedb.zip
FS: Fix segfault in URI handling
Diffstat (limited to 'src')
-rw-r--r--src/fs/fs_uri.c26
1 files changed, 16 insertions, 10 deletions
diff --git a/src/fs/fs_uri.c b/src/fs/fs_uri.c
index 299dc3159..dff94ee26 100644
--- a/src/fs/fs_uri.c
+++ b/src/fs/fs_uri.c
@@ -644,6 +644,7 @@ struct GNUNET_FS_Uri *
644GNUNET_FS_uri_parse (const char *uri, char **emsg) 644GNUNET_FS_uri_parse (const char *uri, char **emsg)
645{ 645{
646 struct GNUNET_FS_Uri *ret; 646 struct GNUNET_FS_Uri *ret;
647 char *msg;
647 648
648 if (NULL == uri) 649 if (NULL == uri)
649 { 650 {
@@ -655,20 +656,25 @@ GNUNET_FS_uri_parse (const char *uri, char **emsg)
655 /** 656 /**
656 * FIXME: Do we want to log this? 657 * FIXME: Do we want to log this?
657 */ 658 */
658 *emsg = NULL; 659 msg = NULL;
659 if (NULL != (ret = uri_chk_parse (uri, emsg))) 660 if (NULL != (ret = uri_chk_parse (uri, &msg)))
660 return ret; 661 return ret;
661 GNUNET_free (*emsg); 662 if (NULL != msg)
662 if (NULL != (ret = uri_ksk_parse (uri, emsg))) 663 GNUNET_free (msg);
664 if (NULL != (ret = uri_ksk_parse (uri, &msg)))
663 return ret; 665 return ret;
664 GNUNET_free (*emsg); 666 if (NULL != msg)
665 if (NULL != (ret = uri_sks_parse (uri, emsg))) 667 GNUNET_free (msg);
668 if (NULL != (ret = uri_sks_parse (uri, &msg)))
666 return ret; 669 return ret;
667 GNUNET_free (*emsg); 670 if (NULL != msg)
668 if (NULL != (ret = uri_loc_parse (uri, emsg))) 671 GNUNET_free (msg);
672 if (NULL != (ret = uri_loc_parse (uri, &msg)))
669 return ret; 673 return ret;
670 GNUNET_free (*emsg); 674 if (NULL != msg)
671 *emsg = GNUNET_strdup (_ ("Unrecognized URI type")); 675 GNUNET_free (msg);
676 if (NULL != emsg)
677 *emsg = GNUNET_strdup (_ ("Unrecognized URI type"));
672 return NULL; 678 return NULL;
673} 679}
674 680