1
0
mirror of https://git.FreeBSD.org/ports.git synced 2024-11-26 00:55:14 +00:00

Fix a potential buffer overflow.

PR:		128216
Submitted by:	maintainer
This commit is contained in:
Stefan Walter 2008-10-19 08:09:02 +00:00
parent cf192abfd0
commit 034313dfd8
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=221768
2 changed files with 29 additions and 1 deletions

View File

@ -7,7 +7,7 @@
PORTNAME= qpage
PORTVERSION= 3.3
PORTREVISION= 4
PORTREVISION= 5
CATEGORIES= comms
MASTER_SITES= http://www.qpage.org/download/
EXTRACT_SUFX= .tar.Z

View File

@ -0,0 +1,28 @@
--- srvrsnpp.c.orig 1998-10-25 14:55:05.000000000 -0500
+++ srvrsnpp.c 2008-10-18 18:09:44.175331511 -0400
@@ -523,6 +523,7 @@
char *errmsg;
char *a;
char *b;
+ char *m;
int i;
int badarg;
int gotpager;
@@ -701,7 +702,16 @@
p->created = time(NULL);
(void)sprintf(buff, "%d", pagecount++);
- (void)strcat(p->messageid, buff);
+ m = (void *)malloc(sizeof(*m) * strlen(p->messageid) + sizeof(*m) * strlen(buff));
+ if ( m == NULL ) {
+ message("554 Message failed (out of memory)");
+ qpage_log(LOG_ERR, "snpp(): cannot allocate memory for p->messageid");
+ clear_page(p, TRUE);
+ break;
+ }
+ (void)sprintf(m, "%s%s", p->messageid, buff);
+ my_free(p->messageid);
+ p->messageid = m;
qpage_log(LOG_ALERT, "page submitted, id=%s, from=%s",
p->messageid,