[omniORB] Bug in orbOptions::dumpSpecified

Serguei Kolos Serguei.Kolos at cern.ch
Tue Oct 21 10:57:10 BST 2003


Hello
I have found a bug in the orbOptions::dumpSpecified function (file 
orbOptions.cc:346).
There is one line missed in this function - it does not set the sequence 
length before
assigning values to it.
Cheers,
Sergei

The following fragment of orbOptions.cc shows the correction:

orbOptions::sequenceString*
orbOptions::dumpSpecified() const {

  sequenceString_var result(new sequenceString(pd_values.size()));
 
+ result->length(pd_values.size()); // THIS LINE WAS MISSED
 
  omnivector<HandlerValuePair*>::const_iterator i = pd_values.begin();
  omnivector<HandlerValuePair*>::const_iterator last = pd_values.end();

  int j = 0;
  for (; i != last; i++,j++) {
    CORBA::String_var kv;
    CORBA::ULong l = strlen((*i)->handler_->key()) + 
strlen((*i)->value_) + 3;
    kv = CORBA::string_alloc(l);
    sprintf(kv,"%s = %s",
        (*i)->handler_->key(),(const char*)((*i)->value_));
    result[j] = kv._retn(); // HERE THIS FUNCTION CRASHES 
IF result->length(...) WAS NOT CALLED
  }
  return result._retn();

}





More information about the omniORB-list mailing list