Procházet zdrojové kódy

Randomize and minor bug

Added randomize on starts and corrected bug on get accounts net call
PascalCoin před 7 roky
rodič
revize
1c7cac7f38
2 změnil soubory, kde provedl 4 přidání a 1 odebrání
  1. 1 0
      src/core/UCrypto.pas
  2. 3 1
      src/core/UNetProtocol.pas

+ 1 - 0
src/core/UCrypto.pas

@@ -850,5 +850,6 @@ end;
 
 
 initialization
+  Randomize; // Initial random generator based on system time
 finalization
 end.

+ 3 - 1
src/core/UNetProtocol.pas

@@ -2847,8 +2847,10 @@ begin
       end;
     end else if (b=3) then begin
       DataBuffer.Read(c,SizeOf(c));
+      if (c>CT_Max_Accounts_per_call) then c := CT_Max_Accounts_per_call;
       responseStream.Write(c,SizeOf(c));
-      for i:=1 to b do begin
+      max := c;
+      for i:=1 to max do begin
         DataBuffer.Read(c,SizeOf(c));
         if (c>=0) And (c<TNode.Node.Bank.AccountsCount) then begin
           acc := TNode.Node.Bank.SafeBox.Account(c);