Skip to content

Commit

Permalink
check whether toUserName or fromUserName are empty
Browse files Browse the repository at this point in the history
  • Loading branch information
dukelsky committed Apr 15, 2020
1 parent c09cc3f commit f4f6bf9
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 4 deletions.
2 changes: 1 addition & 1 deletion h/cvsdate.h
Original file line number Diff line number Diff line change
@@ -1 +1 @@
char cvs_date[]="2020-04-14";
char cvs_date[]="2020-04-15";
2 changes: 1 addition & 1 deletion hpt.spec
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
%define reldate 20200414
%define reldate 20200415
%define reltype C
# may be one of: C (current), R (release), S (stable)

Expand Down
14 changes: 12 additions & 2 deletions src/pktread.c
Original file line number Diff line number Diff line change
Expand Up @@ -615,7 +615,12 @@ int readMsgFromPkt(FILE *pkt, s_pktHeader *header, s_message **message)
}

len = fgetsUntil0 ((UCHAR *) globalBuffer, BUFFERSIZE+1, pkt, NULL);
if (len > XMSG_TO_SIZE) {
if(len == 1)
{
w_log(LL_ERR, "wrong msg header: toUserName is empty");
badmsg++;
}
else if (len > XMSG_TO_SIZE) {
if (config->intab) recodeToInternalCharset((char*) globalBuffer);
w_log(LL_ERR, "wrong msg header: toUserName (%s) is longer than %d bytes.",
globalBuffer, XMSG_TO_SIZE-1);
Expand All @@ -626,7 +631,12 @@ int readMsgFromPkt(FILE *pkt, s_pktHeader *header, s_message **message)
xstrcat(&msg->toUserName, (char *) globalBuffer);

len = fgetsUntil0((UCHAR *) globalBuffer, BUFFERSIZE+1, pkt, NULL);
if (len > XMSG_FROM_SIZE) {
if(len == 1)
{
w_log(LL_ERR, "wrong msg header: fromUserName is empty");
badmsg++;
}
else if (len > XMSG_FROM_SIZE) {
if (config->intab) recodeToInternalCharset((char*) globalBuffer);
w_log(LL_ERR, "wrong msg header: fromUserName (%s) is longer than %d bytes.",
globalBuffer, XMSG_FROM_SIZE-1);
Expand Down

0 comments on commit f4f6bf9

Please sign in to comment.