🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Thread View: comp.windows.interviews
1 messages
1 total messages Started by Dag Bruck Thu, 17 Dec 1992 12:18
Bug fix for Font::Width (InterViews 2.6)
#1357
Author: Dag Bruck
Date: Thu, 17 Dec 1992 12:18
29 lines
1239 bytes
I don't know if anybody's interested in InterViews 2.6, but maybe it
also applies to later versions.

I have found a bug in Font::Width(const char*, int), where `p' will
access memory outside the allocated array of characters if the string
is not nul-terminated.  I think my fix is ok.

Here is the context diff:

*** /tmp/T0a03374       Thu Dec 17 13:14:05 1992
--- X11-paint.C Thu Dec 17 12:03:24 1992
***************
*** 224,230 ****
      register const char* p, * q;
  
      q = &s[len];
!     for (p = s; *p != '\0' && p < q; p++);
      return XTextWidth((XFontStruct*)rep->info, s, p - s);
  }
  
--- 224,230 ----
      register const char* p, * q;
  
      q = &s[len];
!     for (p = s; p < q && *p != '\0'; p++);
      return XTextWidth((XFontStruct*)rep->info, s, p - s);
  }

Dag Bruck
Thread Navigation

This is a paginated view of messages in the thread with full content displayed inline.

Messages are displayed in chronological order, with the original post highlighted in green.

Use pagination controls to navigate through all messages in large threads.

Back to All Threads