Fix a pile of identBuf parsing issues that occur if you forget an argument for a specific buf type

git-svn-id: file:///home/svn/framework3/trunk@6970 4d416f70-5f16-0410-b530-b9f4589650da
unstable
pusscat 2009-08-21 12:48:16 +00:00
parent 1bfd5a1cd6
commit 56881d35d2
13 changed files with 6 additions and 2 deletions

Binary file not shown.

Binary file not shown.

View File

@ -194,7 +194,10 @@ HRESULT CALLBACK jutsu(PDEBUG_CLIENT4 Client, PCSTR args) {
dprintf("[Byakugan] This command requires a buffer type, name, (sometimes) value, and size\n");
return (S_OK);
}
identBufJutsu(bufType, bufName, bufPatt, strtoul(bufSize, NULL, 10));
if (bufSize == NULL)
identBufJutsu(bufType, bufName, bufPatt, 0);
else
identBufJutsu(bufType, bufName, bufPatt, strtoul(bufSize, NULL, 10));
return (S_OK);
}
if (!_stricmp(command, "hunt")) {

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -533,6 +533,7 @@ void identBufJutsu(char *inputType, char *bufName, char *bufPatt, DWORD size) {
readSize = readFileIntoBuf(bufPatt, size, &(newTrackedBuf->bufPatt));
if ((size && readSize != size) || readSize == 0) {
dprintf("[J] Unable to read %d bytes from %s\n", size, bufName);
dprintf("\nThis command requires a buffer type, name, (sometimes) value, and size - maybe you forgot one?\n");
return;
}
size = (size ? size : readSize);

View File

@ -297,7 +297,7 @@ DWORD readFileIntoBuf(char *path, DWORD size, char **output) {
if((inputFile = CreateFile(path, GENERIC_READ, FILE_SHARE_READ, NULL, OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL, NULL)) == INVALID_HANDLE_VALUE) {
dprintf("[S] Unable to open file: %s\n", path);
return (-1);
return (0);
}
if (size == 0)
size = GetFileSize(inputFile, NULL) - 1;