aboutsummaryrefslogtreecommitdiff
path: root/src/fs/fs_uri.c
diff options
context:
space:
mode:
authorChristian Grothoff <christian@grothoff.org>2015-01-07 12:39:55 +0000
committerChristian Grothoff <christian@grothoff.org>2015-01-07 12:39:55 +0000
commitc1fc2480f5e95ff937a1bf0f67410701465ed698 (patch)
tree41725a10dea4ee2204414fa305ee27655b3ff958 /src/fs/fs_uri.c
parent88fd2812da3200f5005f4e9c682643543e32204f (diff)
downloadgnunet-c1fc2480f5e95ff937a1bf0f67410701465ed698.tar.gz
gnunet-c1fc2480f5e95ff937a1bf0f67410701465ed698.zip
-check once, and consistently
Diffstat (limited to 'src/fs/fs_uri.c')
-rw-r--r--src/fs/fs_uri.c12
1 files changed, 7 insertions, 5 deletions
diff --git a/src/fs/fs_uri.c b/src/fs/fs_uri.c
index 883e4b84a..752349212 100644
--- a/src/fs/fs_uri.c
+++ b/src/fs/fs_uri.c
@@ -272,7 +272,6 @@ uri_ksk_parse (const char *s,
272 char *dup; 272 char *dup;
273 int saw_quote; 273 int saw_quote;
274 274
275 GNUNET_assert (NULL != s);
276 slen = strlen (s); 275 slen = strlen (s);
277 pos = strlen (GNUNET_FS_URI_KSK_PREFIX); 276 pos = strlen (GNUNET_FS_URI_KSK_PREFIX);
278 if ((slen <= pos) || (0 != strncmp (s, GNUNET_FS_URI_KSK_PREFIX, pos))) 277 if ((slen <= pos) || (0 != strncmp (s, GNUNET_FS_URI_KSK_PREFIX, pos)))
@@ -363,7 +362,6 @@ uri_sks_parse (const char *s,
363 size_t pos; 362 size_t pos;
364 char *end; 363 char *end;
365 364
366 GNUNET_assert (s != NULL);
367 pos = strlen (GNUNET_FS_URI_SKS_PREFIX); 365 pos = strlen (GNUNET_FS_URI_SKS_PREFIX);
368 if ((strlen (s) <= pos) || (0 != strncmp (s, GNUNET_FS_URI_SKS_PREFIX, pos))) 366 if ((strlen (s) <= pos) || (0 != strncmp (s, GNUNET_FS_URI_SKS_PREFIX, pos)))
369 return NULL; /* not an SKS URI */ 367 return NULL; /* not an SKS URI */
@@ -408,9 +406,6 @@ uri_chk_parse (const char *s,
408 char h1[sizeof (struct GNUNET_CRYPTO_HashAsciiEncoded)]; 406 char h1[sizeof (struct GNUNET_CRYPTO_HashAsciiEncoded)];
409 char h2[sizeof (struct GNUNET_CRYPTO_HashAsciiEncoded)]; 407 char h2[sizeof (struct GNUNET_CRYPTO_HashAsciiEncoded)];
410 408
411 if (NULL == s)
412 return NULL;
413 GNUNET_assert (s != NULL);
414 slen = strlen (s); 409 slen = strlen (s);
415 pos = strlen (GNUNET_FS_URI_CHK_PREFIX); 410 pos = strlen (GNUNET_FS_URI_CHK_PREFIX);
416 if ((slen < pos + 2 * sizeof (struct GNUNET_CRYPTO_HashAsciiEncoded) + 1) || 411 if ((slen < pos + 2 * sizeof (struct GNUNET_CRYPTO_HashAsciiEncoded) + 1) ||
@@ -629,6 +624,13 @@ GNUNET_FS_uri_parse (const char *uri,
629 struct GNUNET_FS_Uri *ret; 624 struct GNUNET_FS_Uri *ret;
630 char *msg; 625 char *msg;
631 626
627 if (NULL == uri)
628 {
629 GNUNET_break (0);
630 if (NULL != emsg)
631 *emsg = GNUNET_strdup (_("invalid argument"));
632 return NULL;
633 }
632 if (NULL == emsg) 634 if (NULL == emsg)
633 emsg = &msg; 635 emsg = &msg;
634 *emsg = NULL; 636 *emsg = NULL;