From 6773b8dcb4e3a26a35b6e0fd763bf46340d77e08 Mon Sep 17 00:00:00 2001 From: obarthel Date: Sun, 20 May 2018 17:27:47 +0200 Subject: [PATCH] Updated to version 1.134 Please keep in mind that this is still a development version and might surprise you (not necessarily in a good way). Do not let me discourage you to build and test this version, although there will be some risks involved such as data corruption or loss of data. --- documentation/history.doc | 8 ++++++++ source_code/main.c | 14 +++++++------- source_code/smbfs_rev.h | 8 ++++---- source_code/smbfs_rev.rev | 2 +- source_code/sock.c | 32 ++++++++++++++++++++++++-------- 5 files changed, 44 insertions(+), 20 deletions(-) diff --git a/documentation/history.doc b/documentation/history.doc index 8d1b069..d046abc 100644 --- a/documentation/history.doc +++ b/documentation/history.doc @@ -1593,3 +1593,11 @@ smbfs 1.133 (20.5.2018) if the protection fron writing was in effect, too. Now we have a functionally identical mapping which hinges only on the delete protection. + + +smbfs 1.134 (20.5.2018) + +- Ouch, so smb_trans2_request() no longer has to return any transaction + parameter or data response information, but the code still updated the + respective pointer and length information passed as pointers, even + if these pointers were NULL... diff --git a/source_code/main.c b/source_code/main.c index 4407b60..f629eee 100644 --- a/source_code/main.c +++ b/source_code/main.c @@ -383,9 +383,9 @@ _start(STRPTR args, LONG args_length, struct ExecBase * exec_base) result = swap_stack_and_call(stk,(APTR)main); /* Testing: figure out how much stack space was used. */ - /* Printf("stack size used = %ld\n",stack_usage_exit(stk)); */ + /* Printf("stack size used = %lu\n",stack_usage_exit(stk)); */ } - /* Sufficient stack space is available. */ + /* Sufficient stack space should be available. */ else { result = main(); @@ -486,16 +486,16 @@ stack_usage_init(struct StackSwapStruct * stk) /* Testing: Check how much stack space was used by looking at where * the test pattern previously written to the stack memory was - * overwritten. Returns how much space was used in bytes. + * overwritten. Returns how much space was used (in bytes). */ STATIC ULONG stack_usage_exit(const struct StackSwapStruct * stk) { const UBYTE * m = (const UBYTE *)stk->stk_Lower; size_t stack_size = ((ULONG)stk->stk_Upper - (ULONG)stk->stk_Lower); - size_t total,i; + size_t unused_stack_space,i; - total = 0; + unused_stack_space = 0; /* Figure out how much of the stack was used by checking * if the fill pattern was overwritten. @@ -508,10 +508,10 @@ stack_usage_exit(const struct StackSwapStruct * stk) if(i > sizeof(LONG) && m[i] != STACK_FILL_COOKIE) break; - total++; + unused_stack_space++; } - return(total); + return(stack_size - unused_stack_space); } /****************************************************************************/ diff --git a/source_code/smbfs_rev.h b/source_code/smbfs_rev.h index 6365c4f..308f3c9 100644 --- a/source_code/smbfs_rev.h +++ b/source_code/smbfs_rev.h @@ -1,6 +1,6 @@ #define VERSION 1 -#define REVISION 133 +#define REVISION 134 #define DATE "20.5.2018" -#define VERS "smbfs 1.133" -#define VSTRING "smbfs 1.133 (20.5.2018)\r\n" -#define VERSTAG "\0$VER: smbfs 1.133 (20.5.2018)" +#define VERS "smbfs 1.134" +#define VSTRING "smbfs 1.134 (20.5.2018)\r\n" +#define VERSTAG "\0$VER: smbfs 1.134 (20.5.2018)" diff --git a/source_code/smbfs_rev.rev b/source_code/smbfs_rev.rev index 6a4573e..405e2af 100644 --- a/source_code/smbfs_rev.rev +++ b/source_code/smbfs_rev.rev @@ -1 +1 @@ -133 +134 diff --git a/source_code/sock.c b/source_code/sock.c index c8e34f0..feb3dac 100644 --- a/source_code/sock.c +++ b/source_code/sock.c @@ -641,8 +641,18 @@ smb_receive_trans2 ( ASSERT( error_ptr != NULL ); - (*data_len_ptr) = (*param_len_ptr) = 0; - (*param_ptr) = (*data_ptr) = NULL; + /* Careful: any of the "pass by reference" parameters may be NULL. */ + if(data_len_ptr != NULL) + (*data_len_ptr) = 0; + + if(param_len_ptr != NULL) + (*param_len_ptr) = 0; + + if(param_ptr != NULL) + (*param_ptr) = NULL; + + if(data_ptr != NULL) + (*data_ptr) = NULL; result = smb_receive (server, command, sock_fd, NULL, 0, error_ptr); if (result < 0) @@ -782,13 +792,19 @@ smb_receive_trans2 ( } } - (*param_ptr) = param; - (*param_len_ptr) = param_len; - param = NULL; + if(param_ptr != NULL && param_len_ptr != NULL) + { + (*param_ptr) = param; + (*param_len_ptr) = param_len; + param = NULL; + } - (*data_ptr) = data; - (*data_len_ptr) = data_len; - data = NULL; + if(data_ptr != NULL && data_len_ptr != NULL) + { + (*data_ptr) = data; + (*data_len_ptr) = data_len; + data = NULL; + } result = 0;