diff --git a/source/libsmb/libsmbclient.c b/source/libsmb/libsmbclient.c index 6b4ae9f4b70..15355016d0a 100644 --- a/source/libsmb/libsmbclient.c +++ b/source/libsmb/libsmbclient.c @@ -1200,7 +1200,7 @@ smbc_read_ctx(SMBCCTX *context, * the call to cli_read() instead of file->offset fixes a problem * retrieving data at an offset greater than 4GB. */ - off_t offset = file->offset; + off_t offset; if (!context || !context->internal || !context->internal->_initialized) { @@ -1219,6 +1219,8 @@ smbc_read_ctx(SMBCCTX *context, } + offset = file->offset; + /* Check that the buffer exists ... */ if (buf == NULL) {