Bug 94940 - Subscript out of range
Summary: Subscript out of range
Status: RESOLVED FIXED
Alias: None
Product: kontact
Classification: Applications
Component: calendar (show other bugs)
Version: unspecified
Platform: Compiled Sources Linux
: NOR normal
Target Milestone: ---
Assignee: kdepim bugs
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2004-12-11 18:46 UTC by Marcin Garski
Modified: 2005-02-20 16:24 UTC (History)
0 users

See Also:
Latest Commit:
Version Fixed In:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Marcin Garski 2004-12-11 18:46:35 UTC
Version:            (using KDE Devel)
Installed from:    Compiled sources

File kdepim/libkcal/versit/vobject.c contain writeGroup() function.

There is statement:
buf2[sizeof(buf2)] = '\0';

but char buf2[256].

Suggested resolution:
buf2[sizeof(buf2)-1] = '\0';
Comment 1 Reinhold Kainhofer 2005-02-20 16:24:42 UTC
CVS commit by kainhofe: 

Fix possible crash, indices are 0-based... Thanks to Marcin Garski.
BUG:94940


  M +1 -1      vobject.c   1.5


--- kdepim/libkcal/versit/vobject.c  #1.4:1.5
@@ -1228,5 +1228,5 @@ static void writeGroup(OFile *fp, VObjec
     while ((o=isAPropertyOf(o,VCGroupingProp)) != 0) {
         strncpy(buf2,STRINGZ_VALUE_OF(o),sizeof(buf2));
-        buf2[sizeof(buf2)] = '\0';
+        buf2[sizeof(buf2)-1] = '\0';
         strncat(buf2,".",sizeof(buf2)-strlen(buf2)-1);
         strncat(buf2,buf1,sizeof(buf2)-strlen(buf2)-1);