Skip to content

Commit

Permalink
fixed race conditions in sqFilePluginBasicPrims.c's sqFileOpen(), add…
Browse files Browse the repository at this point in the history
…ed sqFileOpenNew(), fixed buffer overflows in sqUnixFile.c
  • Loading branch information
Monty authored and fniephaus committed Oct 25, 2016
1 parent 4b54cb0 commit f949f8f
Show file tree
Hide file tree
Showing 8 changed files with 687 additions and 328 deletions.
21 changes: 12 additions & 9 deletions platforms/Cross/plugins/FilePlugin/FilePlugin.h
Expand Up @@ -15,6 +15,8 @@
*/
/* File support definitions */

#include <sys/types.h>

#include "sqMemoryAccess.h"

/* squeak file record; see sqFilePrims.c for details */
Expand All @@ -40,22 +42,23 @@ typedef struct {

sqInt sqFileAtEnd(SQFile *f);
sqInt sqFileClose(SQFile *f);
sqInt sqFileDeleteNameSize(char* sqFileNameIndex, sqInt sqFileNameSize);
sqInt sqFileDeleteNameSize(char *sqFileName, sqInt sqFileNameSize);
squeakFileOffsetType sqFileGetPosition(SQFile *f);
sqInt sqFileInit(void);
sqInt sqFileShutdown(void);
sqInt sqFileOpen(SQFile *f, char* sqFileNameIndex, sqInt sqFileNameSize, sqInt writeFlag);
size_t sqFileReadIntoAt(SQFile *f, size_t count, char* byteArrayIndex, size_t startIndex);
sqInt sqFileRenameOldSizeNewSize(char* oldNameIndex, sqInt oldNameSize, char* newNameIndex, sqInt newNameSize);
sqInt sqFileOpen(SQFile *f, char *sqFileName, sqInt sqFileNameSize, sqInt writeFlag);
sqInt sqFileOpenNew(SQFile *f, char *sqFileName, sqInt sqFileNameSize);
size_t sqFileReadIntoAt(SQFile *f, size_t count, char *byteArrayIndex, size_t startIndex);
sqInt sqFileRenameOldSizeNewSize(char *sqOldName, sqInt sqOldNameSize, char *sqNewName, sqInt sqNewNameSize);
sqInt sqFileSetPosition(SQFile *f, squeakFileOffsetType position);
squeakFileOffsetType sqFileSize(SQFile *f);
sqInt sqFileValid(SQFile *f);
size_t sqFileWriteFromAt(SQFile *f, size_t count, char* byteArrayIndex, size_t startIndex);
size_t sqFileWriteFromAt(SQFile *f, size_t count, char *byteArrayIndex, size_t startIndex);
sqInt sqFileFlush(SQFile *f);
sqInt sqFileSync(SQFile *f);
sqInt sqFileTruncate(SQFile *f,squeakFileOffsetType offset);
sqInt sqFileTruncate(SQFile *f, squeakFileOffsetType offset);
sqInt sqFileThisSession(void);
sqInt sqFileStdioHandlesInto(SQFile files[3]);
sqInt sqFileStdioHandlesInto(SQFile files[]);

/* directories */

Expand All @@ -67,7 +70,7 @@ sqInt dir_Lookup(char *pathString, sqInt pathStringLength, sqInt index,
/* outputs: */
char *name, sqInt *nameLength, sqInt *creationDate, sqInt *modificationDate,
sqInt *isDirectory, squeakFileOffsetType *sizeIfFile, sqInt *posixPermissions, sqInt *isSymlink);
sqInt dir_EntryLookup(char *pathString, sqInt pathStringLength, char* nameString, sqInt nameStringLength,
sqInt dir_EntryLookup(char *pathString, sqInt pathStringLength, char *nameString, sqInt nameStringLength,
/* outputs: */
char *name, sqInt *nameLength, sqInt *creationDate, sqInt *modificationDate,
sqInt *isDirectory, squeakFileOffsetType *sizeIfFile, sqInt *posixPermissions, sqInt *isSymlink);
Expand All @@ -76,7 +79,7 @@ sqInt dir_Lookup(char *pathString, sqInt pathStringLength, sqInt index,
/* outputs: */
char *name, sqInt *nameLength, sqInt *creationDate, sqInt *modificationDate,
sqInt *isDirectory, squeakFileOffsetType *sizeIfFile);
sqInt dir_EntryLookup(char *pathString, sqInt pathStringLength, char* nameString, sqInt nameStringLength,
sqInt dir_EntryLookup(char *pathString, sqInt pathStringLength, char *nameString, sqInt nameStringLength,
/* outputs: */
char *name, sqInt *nameLength, sqInt *creationDate, sqInt *modificationDate,
sqInt *isDirectory, squeakFileOffsetType *sizeIfFile);
Expand Down

0 comments on commit f949f8f

Please sign in to comment.