Commit 01a3f774 authored by Stewart Brodie's avatar Stewart Brodie
Browse files

Fixed use of uninitialised pointer.

  Now doesn't require that the !ArmBoot object is a directory
Detail:
  The code in Omni.c was carefully checking that !ARMBOOT existed
    before attempting to run the boot file.  Unfortunately, it was
    using a method which bypassed the filename resolution (that does
    the ,xxx filetype name mapping), so it did not find the new Obey
    file in the 400 series baseline.  The check has been removed.
  The code in SMB.c was being caught out on an uninitialised variable
    usage when the attribute cache already held details of the object
    being sought.  The variable would have been initialised on a non-
    cached lookup, but the special case of booting a machine via LanManFS
    manages to get a cached lookup without having run through the routine
    before, resulting in a strcpy() with a destination of 0.
Admin:
  Tested on Risc PC.
  Fixes fault 1511 (STB-400 Generic)

Version 2.11. Tagged as 'LanManFS-2_11'
parent 36543191
/* (2.10) /* (2.11)
* *
* This file is automatically maintained by srccommit, do not edit manually. * This file is automatically maintained by srccommit, do not edit manually.
* *
*/ */
#define Module_MajorVersion_CMHG 2.10 #define Module_MajorVersion_CMHG 2.11
#define Module_MinorVersion_CMHG #define Module_MinorVersion_CMHG
#define Module_Date_CMHG 21 Jan 2000 #define Module_Date_CMHG 04 Apr 2000
#define Module_MajorVersion "2.10" #define Module_MajorVersion "2.11"
#define Module_Version 210 #define Module_Version 211
#define Module_MinorVersion "" #define Module_MinorVersion ""
#define Module_Date "21 Jan 2000" #define Module_Date "04 Apr 2000"
#define Module_FullVersion "2.10" #define Module_FullVersion "2.11"
...@@ -399,10 +399,19 @@ static void MountNameCpy ( char *d, char *s ) ...@@ -399,10 +399,19 @@ static void MountNameCpy ( char *d, char *s )
static int ReentryCount = 0; static int ReentryCount = 0;
#ifdef CHECK_ARMBOOT_EXISTS
static err_t BootMount_check_file ( char drive )
{
DOS_ATTRIBS dummy;
sprintf ( work_buf, "%c\\!ARMBOOT", drive );
return SMB_GetAttribs ( work_buf, &dummy );
}
#endif
static err_t BootMount ( NAMELIST *pNLmount ) static err_t BootMount ( NAMELIST *pNLmount )
{ {
_kernel_swi_regs R; _kernel_swi_regs R;
DOS_ATTRIBS dummy;
err_t res; err_t res;
/* Attempts to run a !ArmBoot file or applicationn, if it exists */ /* Attempts to run a !ArmBoot file or applicationn, if it exists */
...@@ -416,15 +425,17 @@ static err_t BootMount ( NAMELIST *pNLmount ) ...@@ -416,15 +425,17 @@ static err_t BootMount ( NAMELIST *pNLmount )
} }
} }
sprintf ( work_buf, "%c\\!ARMBOOT", pNLmount->u.mount.smb_lettr );
#ifdef TRACE #ifdef TRACE
debug1("BootMount looking for %s\n", work_buf); debug1("BootMount looking for %s\n", work_buf);
#endif #endif
/* If no such file or directory, we can stop now */ /* If no such file or directory, we can stop now */
if ( SMB_GetAttribs ( work_buf, &dummy ) != OK ) #ifdef CHECK_ARMBOOT_EXISTS
/* Only works if !ARMBOOT is a directory! */
if (BootMount_check_file(pNLmount->u.mount.smb_lettr) != OK)
return OK; return OK;
#endif
/* Safety check */ /* Safety check */
......
...@@ -1828,8 +1828,10 @@ static err_t SMB_GetAttribsX2 (hSHARE hS, char *filename, DOS_ATTRIBS *pAttr ) ...@@ -1828,8 +1828,10 @@ static err_t SMB_GetAttribsX2 (hSHARE hS, char *filename, DOS_ATTRIBS *pAttr )
BYTE *resb; BYTE *resb;
static struct TransactParms tp; static struct TransactParms tp;
debug1("SMB_GetAttribs: %s\n", filename);
resb = NameCache_Locate(filename); resb = NameCache_Locate(filename);
if (resb != NULL) { if (resb != NULL) {
Transact_init(&tp, 1 * 2); /* need to initialise tp.data_out_buf!! */
memcpy( tp.data_out_buf, resb, 23); memcpy( tp.data_out_buf, resb, 23);
strcpy( (char *) tp.data_out_buf + 23, (char *) resb + 23); strcpy( (char *) tp.data_out_buf + 23, (char *) resb + 23);
return Xlt_ExpandSearchEntryX2 ( tp.data_out_buf, NULL, NULL, pAttr, NULL); return Xlt_ExpandSearchEntryX2 ( tp.data_out_buf, NULL, NULL, pAttr, NULL);
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment