dbpr: Catch buffer overflow from long link strings.

Fixes lp: #1776141

Currently this just truncates when we hit the end of the buffer,
a better solution is warranted.
This commit is contained in:
Andrew Johnson
2018-06-26 18:14:26 -05:00
parent 4e24acebfe
commit 6761726e95
+3 -2
View File
@@ -42,12 +42,13 @@
#include "special.h"
#define MAXLINE 80
#define MAXMESS 128
struct msgBuff { /* line output structure */
char out_buff[MAXLINE + 1];
char *pNext;
char *pLast;
char *pNexTab;
char message[128];
char message[MAXMESS];
};
typedef struct msgBuff TAB_BUFFER;
@@ -1149,7 +1150,7 @@ static int dbpr_report(
break;
}
}
sprintf(pmsg,"%-4s: %s %s", pfield_name,
epicsSnprintf(pmsg, MAXMESS, "%-4s: %s %s", pfield_name,
type, dbGetString(pdbentry));
dbpr_msgOut(pMsgBuff, tab_size);
}