Wow, we've been choking on that one for years.
As soon as I can make the time I'll try it.

------ Original Message ------
Received: 03:29 PM EDT, 04/18/2013
From: Buck Calabro <kc2hiz@xxxxxxxxx>
To: linux5250@xxxxxxxxxxxx
Subject: [LINUX5250] 0.17.4 Win32 paste bug and possible fix

I love tn5250 and am grateful that we have a community of people who
support it. I myself am barely able to walk through the code so I
appreciate the list looking over my shoulder...

I had a long standing bug whereby I would copy some long-ish SQL out of
a Word document and paste it into my tn5250 session and the session
would crash with a Windows message saying that tn5250.exe has stopped
working. I could never put my finger on the exact circumstances, and it
never bothered me that much until recently when I had to do a LOT of

So I started digging. Got to win32_paste_text_selection and started
putting in TN5250_LOG() statements. Too busy to learn gdb :-( I
eventually narrowed the error down to the bottom, 'free(pNewBuf);'
Which didn't make much sense to me unless something had inadvertently
stepped on pNewBuf. I'm still not a C programmer despite several hours
of looking at the code (ha!), but the only place it looks like this
routine could possibly step on pNewBuf is up above, where it says 'just
a precaution'.

if (hBuf != NULL) {
size = GlobalSize(hBuf);
TN5250_LOG (("Windows clipboard size %d\n", size));
pNewBuf = malloc(size);
pBuf = GlobalLock(hBuf);
strncpy(pNewBuf, pBuf, size);
pNewBuf[size] = '\0'; /* just a precaution */

I added the line to increment size and my paste problem has gone away.
Take it out, and it returns.

I hope this makes sense.
This is the Linux 5250 Development Project (LINUX5250) mailing list
To post a message email: LINUX5250@xxxxxxxxxxxx
To subscribe, unsubscribe, or change list options,
or email: LINUX5250-request@xxxxxxxxxxxx
Before posting, please take a moment to review the archives

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2021 by and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.