gnunet-svn
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[taler-anastasis] branch master updated (65833e2 -> 7281285)


From: gnunet
Subject: [taler-anastasis] branch master updated (65833e2 -> 7281285)
Date: Fri, 21 Aug 2020 16:53:11 +0200

This is an automated email from the git hooks/post-receive script.

dennis-neufeld pushed a change to branch master
in repository anastasis.

    from 65833e2  fixed tests
     new a1fc602  fixed solved sign issue in cli assembler
     new 7281285  fix crash when server url is not given with command 'server 
add'

The 2 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 src/cli/anastasis-cli-assembler.c |  5 +--
 src/cli/anastasis-cli-splitter.c  | 64 ++++++++++++++++++++++++++++++++++-----
 2 files changed, 60 insertions(+), 9 deletions(-)

diff --git a/src/cli/anastasis-cli-assembler.c 
b/src/cli/anastasis-cli-assembler.c
index 4727714..cabd4fe 100644
--- a/src/cli/anastasis-cli-assembler.c
+++ b/src/cli/anastasis-cli-assembler.c
@@ -225,8 +225,9 @@ challenge_answer_cb (void *af_cls,
     return;
   }
   printf ("Success truth#%u\n", cs->challenge_index);
-  unsigned int solved = 1;
-  challenges[cs->challenge_index].solved = &solved;
+  unsigned int *solved = GNUNET_new (unsigned int);
+  *solved = 1;
+  challenges[cs->challenge_index].solved = solved;
 }
 
 
diff --git a/src/cli/anastasis-cli-splitter.c b/src/cli/anastasis-cli-splitter.c
index b166065..ba8a5a0 100644
--- a/src/cli/anastasis-cli-splitter.c
+++ b/src/cli/anastasis-cli-splitter.c
@@ -694,6 +694,8 @@ read_keyboard_command (void *cls)
 {
   (void) cls;
 
+  // Configure readline to auto-complete paths when the tab key is hit.
+  rl_bind_key ('\t', rl_complete);
   char *buffer = readline ("anastasis-splitter> ");
   size_t characters = strlen (buffer);
 
@@ -739,6 +741,7 @@ read_keyboard_command (void *cls)
                "Unknown command '%c'\n",
                buffer[0]);
       free (buffer);
+      buffer = (char *)NULL;
       break;
     }
     start_read_keyboard ();
@@ -768,7 +771,7 @@ read_keyboard_command (void *cls)
       printf ("Please add a server before!\n");
 
     free (buffer);
-    buffer = NULL;
+    buffer = (char *)NULL;
     start_read_keyboard ();
     return;
   }
@@ -780,7 +783,16 @@ read_keyboard_command (void *cls)
     struct SaltState *ss = GNUNET_new (struct SaltState);
 
     size_t url_len = characters - strlen ("server add ");
-
+    if (0 == url_len ||
+                characters < strlen ("server add "))
+    {
+      printf ("Sorry, something went wrong with your command: Server Url 
missing.\n");
+      free (buffer);
+      buffer = (char *)NULL;
+      keyboard_task = NULL;
+      start_read_keyboard ();
+      return;
+    }
     char *url = &buffer[strlen ("server add ")];
     server->backend_url = GNUNET_malloc (url_len + 1);
     GNUNET_strlcpy (server->backend_url,
@@ -800,6 +812,7 @@ read_keyboard_command (void *cls)
     {
       GNUNET_break (0);
       free (buffer);
+      buffer = (char *)NULL;
       keyboard_task = NULL;
       return;
     }
@@ -836,7 +849,7 @@ read_keyboard_command (void *cls)
       printf ("Please add a truth before!\n");
 
     free (buffer);
-    buffer = NULL;
+    buffer = (char *)NULL;
     keyboard_task = NULL;
     start_read_keyboard ();
     return;
@@ -867,6 +880,15 @@ read_keyboard_command (void *cls)
                     "At %s:%d server number is %u\n", __FILE__, __LINE__,
                     server_num);
         token = strtok (NULL, " ");
+        if (!token)
+        {
+          printf ("Sorry, something went wrong with your command.\n");
+          free (buffer);
+          buffer = (char *)NULL;
+          keyboard_task = NULL;
+          start_read_keyboard ();
+          return;
+        }
         tus->method = GNUNET_malloc (strlen (token) + 1);
         GNUNET_strlcpy (tus->method,
                         token,
@@ -874,13 +896,21 @@ read_keyboard_command (void *cls)
         GNUNET_log (GNUNET_ERROR_TYPE_DEBUG,
                     "At %s:%d method is %s\n", __FILE__, __LINE__,
                     tus->method);
-
         if (NULL != strstr (servers[server_num].backend_methods,
                             tus->method))
         {
           if (0 == strcmp ("question", tus->method))
           {
             token = strtok (NULL, "\"");
+            if (!token)
+            {
+              printf ("Sorry, something went wrong with your command.\n");
+              free (buffer);
+              buffer = (char *)NULL;
+              keyboard_task = NULL;
+              start_read_keyboard ();
+              return;
+            }
             tus->secret_question = GNUNET_malloc (strlen (token) + 1);
             GNUNET_strlcpy (tus->secret_question,
                             token,
@@ -891,6 +921,15 @@ read_keyboard_command (void *cls)
 
             token = strtok (NULL, "\"");
             token = strtok (NULL, "\"");
+            if (!token)
+            {
+              printf ("Sorry, something went wrong with your command.\n");
+              free (buffer);
+              buffer = (char *)NULL;
+              keyboard_task = NULL;
+              start_read_keyboard ();
+              return;
+            }
             tus->secret_answer = GNUNET_malloc (strlen (token) + 1);
             GNUNET_strlcpy (tus->secret_answer,
                             token,
@@ -928,6 +967,7 @@ read_keyboard_command (void *cls)
                         error.column,
                         error.position);
             free (buffer);
+            buffer = (char *)NULL;
             GNUNET_SCHEDULER_shutdown ();
             return;
           }
@@ -950,6 +990,7 @@ read_keyboard_command (void *cls)
           {
             GNUNET_break (0);
             free (buffer);
+            buffer = (char *)NULL;
             return;
           }
           GNUNET_array_append (tu_states,
@@ -959,6 +1000,7 @@ read_keyboard_command (void *cls)
                   tus->index,
                   server_num);
           free (buffer);
+          buffer = (char *)NULL;
           return;
         }
         else
@@ -971,6 +1013,7 @@ read_keyboard_command (void *cls)
       printf ("Please add a server before!\n");
 
     free (buffer);
+    buffer = (char *)NULL;
     keyboard_task = NULL;
     start_read_keyboard ();
     return;
@@ -1004,6 +1047,7 @@ read_keyboard_command (void *cls)
       printf ("Please add a truth before!\n");
 
     free (buffer);
+    buffer = (char *)NULL;
     start_read_keyboard ();
     return;
   }
@@ -1031,6 +1075,7 @@ read_keyboard_command (void *cls)
     else
       printf ("Please add a policy before!\n");
     free (buffer);
+    buffer = (char *)NULL;
     start_read_keyboard ();
     return;
   }
@@ -1050,6 +1095,7 @@ read_keyboard_command (void *cls)
       {
         printf ("Wrong argument: %s!\n", token);
         free (buffer);
+        buffer = (char *)NULL;
         start_read_keyboard ();
         return;
       }
@@ -1067,6 +1113,7 @@ read_keyboard_command (void *cls)
     printf ("Policy #%u defined\n",
             (pc_states_length > 0) ? pc_states_length - 1 : 0);
     free (buffer);
+    buffer = (char *)NULL;
     start_read_keyboard ();
     return;
   }
@@ -1108,6 +1155,7 @@ read_keyboard_command (void *cls)
                     error.column,
                     error.position);
         free (buffer);
+        buffer = (char *)NULL;
         GNUNET_SCHEDULER_shutdown ();
         return;
       }
@@ -1151,6 +1199,7 @@ read_keyboard_command (void *cls)
                           characters);
           pds[i]->payment_order_id = (const char *) payment_order_id;
           free (buffer);
+          buffer = (char *)NULL;
         }
         printf ("\n");
       }
@@ -1173,12 +1222,15 @@ read_keyboard_command (void *cls)
       {
         GNUNET_break (0);
         free (buffer);
+        buffer = (char *)NULL;
         return;
       }
       free (buffer);
+      buffer = (char *)NULL;
       return;
     }
     free (buffer);
+    buffer = (char *)NULL;
     return;
   }
 
@@ -1186,6 +1238,7 @@ read_keyboard_command (void *cls)
            "Unknown command '%s'\n",
            (char *) buffer);
   free (buffer);
+  buffer = (char *)NULL;
   keyboard_task = NULL;
   start_read_keyboard ();
 }
@@ -1292,9 +1345,6 @@ run (void *cls,
   (void) args;
   (void) cfgfile;
 
-  // Configure readline to auto-complete paths when the tab key is hit.
-  rl_bind_key ('\t', rl_complete);
-
   GNUNET_log (GNUNET_ERROR_TYPE_INFO,
               "Starting anastasis-splitter\n");
 

-- 
To stop receiving notification emails like this one, please contact
gnunet@gnunet.org.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]