~ubuntu-branches/ubuntu/trusty/sblim-sfcb/trusty-proposed

« back to all changes in this revision

Viewing changes to cimslpSLP.c

  • Committer: Bazaar Package Importer
  • Author(s): Thierry Carrez
  • Date: 2009-06-08 12:04:49 UTC
  • mfrom: (1.1.1 upstream)
  • Revision ID: james.westby@ubuntu.com-20090608120449-byfplk09rqz8rtg6
Tags: 1.3.3-0ubuntu1
* New upstream release.
* debian/rules: Removed rpath hacks, SFCB default build handles that now.
* Removed 1934753-remove-assignment.diff, now upstream.
* Refreshed patch cim-schema-location.diff

Show diffs side-by-side

added added

removed removed

Lines of Context:
99
99
{
100
100
        int length=0;
101
101
        int i;
 
102
        int finalAttrLen=0;
102
103
 
103
104
 
104
105
        if(value == NULL) {
109
110
                length += strlen(value[i]);
110
111
        }
111
112
 
 
113
   //Account for the comma delimiters which will be inserted into the string between
 
114
        //each element in the array, one per value array entry. Err on the side of caution
 
115
        //and still count the trailing comma, though it will be clobbered by the final ")"
 
116
        //at the very end.
 
117
   length += i;
 
118
 
112
119
        length = length + strlen(attrstring) + strlen(name) + 5;
113
120
 
114
121
        if(length > size) {
129
136
                strcat(attrstring, value[i]);
130
137
                strcat(attrstring, ",");
131
138
        }
132
 
        attrstring[strlen(attrstring) - 1] = '\0';
133
 
        strcat(attrstring, ")");
 
139
        //Includes the trailing ",", which must be replaced by a ")" followed by a NULL
 
140
        //string delimiter.
 
141
   finalAttrLen = strlen(attrstring);
 
142
        attrstring[finalAttrLen - 1] = ')';
 
143
   attrstring[finalAttrLen] = '\0';
 
144
 
 
145
   if (finalAttrLen + 1 > size) {
 
146
      //buffer overrun. Better to abort here rather than discovering a heap curruption later
 
147
      printf("--- Error:  Buffer overrun in %s. Content size: %d  Buffer size: %d\n",
 
148
                                 "buildAttrStringFromArray", finalAttrLen + 1, size);
 
149
      abort();
 
150
   }
134
151
 
135
152
        return attrstring;
136
153