Skip to content

Commit

Permalink
Fixes segfault in cgi mode by adding a single '*' character
Browse files Browse the repository at this point in the history
  • Loading branch information
ColumPaget committed Jul 31, 2017
1 parent 8f1afe9 commit 213f86c
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ LIBS =
INSTALL=/bin/install -c
prefix=/usr/local
bindir=$(prefix)${exec_prefix}/bin
FLAGS=$(LDFLAGS) $(CPPFLAGS) $(CFLAGS) -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DSTDC_HEADERS=1 -D_FILE_OFFSET_BITS=64 -DHAVE_SYS_TYPES_H=1 -DHAVE_SYS_STAT_H=1 -DHAVE_STDLIB_H=1 -DHAVE_STRING_H=1 -DHAVE_MEMORY_H=1 -DHAVE_STRINGS_H=1 -DHAVE_INTTYPES_H=1 -DHAVE_STDINT_H=1 -DHAVE_UNISTD_H=1 -DUSE_XATTR=1
FLAGS=$(LDFLAGS) $(CPPFLAGS) $(CFLAGS) -DPACKAGE_NAME=\"\" -DPACKAGE_TARNAME=\"\" -DPACKAGE_VERSION=\"\" -DPACKAGE_STRING=\"\" -DPACKAGE_BUGREPORT=\"\" -DPACKAGE_URL=\"\" -DSTDC_HEADERS=1 -D_FILE_OFFSET_BITS=64
OBJ=common.o command-line-args.o ssh.o fingerprint.o files.o filesigning.o xattr.o cgi.o check-hash.o find.o memcached.o
EXE=hashrat

Expand Down
5 changes: 4 additions & 1 deletion cgi.c
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@ printf("</td>\r\n");
}


int CGIParseArgs(char **HashType, char **Encoding, char *LineEnding, char **Text)
int CGIParseArgs(char **HashType, char **Encoding, char **LineEnding, char **Text)
{
char *QName=NULL, *QValue=NULL, *Name=NULL, *Value=NULL, *ptr;
int Flags=0;
Expand Down Expand Up @@ -165,9 +165,12 @@ if (Flags & CGI_DOHASH)
val=MatchTokenFromList(Encoding, EncodingNames, 0);
if (val > -1) Ctx->Encoding=Encodings[i];

if (StrLen(LineEnding))
{
if (strcmp(LineEnding, "crlf")==0) Text=CatStr(Text,"\r\n");
if (strcmp(LineEnding, "lf")==0) Text=CatStr(Text,"\n");
if (strcmp(LineEnding, "cr")==0) Text=CatStr(Text,"\r");
}

ProcessData(&Hash, Ctx, Text, StrLen(Text));

Expand Down

0 comments on commit 213f86c

Please sign in to comment.