Changeset 1079

Show
Ignore:
Timestamp:
10/03/08 12:54:00 (3 months ago)
Author:
mwhitworth
Message:

Remove strcpy, replace calls to strcpy with strncpy, misc formatting fixes.

Location:
Whitix/branches/keobject
Files:
8 modified

Legend:

Unmodified
Added
Removed
  • Whitix/branches/keobject/fs/vfs/dir.c

    r930 r1079  
    473473        { 
    474474                /* Special case, why search for the root directory when it's known? */ 
    475                 strcpy(current->sCwd, dirName); 
     475                strncpy(current->sCwd, dirName, PATH_MAX); 
    476476 
    477477                if (current->cwd != current->root) 
  • Whitix/branches/keobject/fs/vfs/load.c

    r1060 r1079  
    312312 
    313313        /* The child processes have the same current directory as the parent */  
    314         strcpy(process->sCwd,current->sCwd); 
     314        strncpy(process->sCwd, current->sCwd, PATH_MAX); 
    315315 
    316316        process->cwd=current->cwd; 
  • Whitix/branches/keobject/fs/vfs/super.c

    r1061 r1079  
    379379        /* Allocate a current directory string for the kernel loading process */ 
    380380        current->sCwd=(char*)MemAlloc(PATH_MAX); 
    381         strcpy(current->sCwd,"/"); 
     381        strncpy(current->sCwd, "/", 1); 
    382382 
    383383        KePrint("VFS: Sucessfully mounted the root filesystem (%s)\n",curr->name); 
  • Whitix/branches/keobject/include/string.h

    r1053 r1079  
    2424 
    2525int strncpy(char* dest,char* src,int len); 
    26 int strcpy(char* dest,char* src); 
    2726int strncmp(const char* s1,const char* s2,int num); 
    2827int strlen(char* str); 
  • Whitix/branches/keobject/kernel/process.c

    r984 r1079  
    8484        /* Allocate the process's name - used when listing processes or when faulting. */ 
    8585        process->name=(char*)MemAlloc(strlen(name)+1); 
    86         strcpy(process->name, name); 
     86        strncpy(process->name, name, strlen(name)); 
    8787 
    8888        process->pid=pid++; 
  • Whitix/branches/keobject/lib/string.c

    r1067 r1079  
    3232 
    3333SYMBOL_EXPORT(strncpy); 
    34  
    35 int strcpy(char* dest,char* src) 
    36 { 
    37         while ((*dest++=*src++)); 
    38         return 0; 
    39 } 
    40  
    41 SYMBOL_EXPORT(strcpy); 
    4234 
    4335int strncmp(const char* s1,const char* s2,int num) 
     
    198190         
    199191        ret = MemAlloc(strlen(name) + 1); 
    200         strcpy(ret, name); 
     192        strncpy(ret, name, strlen(name)); 
    201193         
    202194        return ret; 
  • Whitix/branches/keobject/make.inc

    r1006 r1079  
    1010SED = sed 
    1111override CFLAGS += -fomit-frame-pointer -ffreestanding -fno-stack-protector -fno-builtin \ 
    12         -nostdlib -m32 -Wall -Wextra -O2 -I$(DEPTH)include -Wno-unused-parameter 
     12        -nostdlib -m32 -Wall -Wextra -Os -I$(DEPTH)include -Wno-unused-parameter 
    1313BE_VERBOSE = 0 
    1414LD_R_FLAGS = -r -melf_i386 
  • Whitix/branches/keobject/memory/mmap.c

    r882 r1079  
    8484                                ret=area->vNode->fileOps->mMap(area->vNode, address, offset); 
    8585                        else 
    86                                 ret=FileGenericReadPage(address,area->vNode,offset); 
     86                                ret=FileGenericReadPage(address, area->vNode, offset); 
    8787 
    8888                        if (ret) 
     
    165165        address=PAGE_ALIGN(address); 
    166166 
    167 //      KePrint("%s: %d: MMapHandleFault(%#X, %d, %d, %d)\n", current->name, current->pid, address, error, VM_WRITE, VM_USER); 
    168  
    169167        /* A null pointer has been deferenced */ 
    170168        if (!process || address < PAGE_SIZE) 
    171169                return -EFAULT; 
    172170 
     171//      KePrint("%s: %d: MMapHandleFault(%#X, %d, %d, %d)\n", current->name, current->pid, address, error, VM_WRITE, VM_USER); 
     172 
    173173        area=VmLookupAddress(process,address); 
    174  
     174         
    175175        /* Area of memory not currently mapped? */ 
    176176        if (!area)