summaryrefslogtreecommitdiff
path: root/lib/ptt.c
diff options
context:
space:
mode:
authorChristoph Berg <myon@debian.org>2026-09-26 23:24:03 +0200
committerChristoph Berg <myon@debian.org>2026-09-26 23:24:03 +0200
commit059831534c7e884f0a607ed86b582fd00d821731 (patch)
tree76bcb67a78f8aa2654fd34c2ad801a62136b0170 /lib/ptt.c
parentd83a420f0517d7fc47aeb288a6a0cf4891784fcc (diff)
New upstream version 3.2.0~rc1+dfsgupstream/3.2.0_rc1+dfsg
Diffstat (limited to 'lib/ptt.c')
-rw-r--r--lib/ptt.c7
1 files changed, 4 insertions, 3 deletions
diff --git a/lib/ptt.c b/lib/ptt.c
index 902193fd..42854cc5 100644
--- a/lib/ptt.c
+++ b/lib/ptt.c
@@ -5,8 +5,8 @@ int ptt_(int *nport, int *ntx, int *iptt)
{
static HANDLE hFile;
static int open=0;
- char s[10];
- int i3=1,i4=1,i5=1,i6=1,i9=1,i00=1;
+ char s[32];
+ int i3=1,i4=1,i5=1,i6=1,i9=1,i00=1,n;
if(*nport==0) {
*iptt=*ntx;
@@ -14,7 +14,8 @@ int ptt_(int *nport, int *ntx, int *iptt)
}
if(*ntx && (!open)) {
- sprintf(s,"\\\\.\\COM%d",*nport);
+ n=snprintf(s,sizeof s,"\\\\.\\COM%d",*nport);
+ if(n < 0 || n >= (int) sizeof s) return 1;
hFile=CreateFile(TEXT(s),GENERIC_WRITE,0,NULL,OPEN_EXISTING,
FILE_ATTRIBUTE_NORMAL,NULL);
if(hFile==INVALID_HANDLE_VALUE) {