tools/dwarfDbg/dwarfDbgEsb.c
/*  The 'len' is believed. Do not pass in strings < len bytes long. */
The 'len' is believed. Do not pass in strings < len bytes long.
The ' len ' is believed . Do not pass in strings < len bytes long .
static uint8_t esbAppendnInternal(dwarfDbgPtr_t self, dwarfDbgEsb_t *data, const char * in_string, size_t len) {
  size_t remaining = 0;
  size_t needed = len;
  if (data->esbAllocatedSize == 0) {
    size_t maxlen = (len >= allocSize) ? (len) : allocSize;
    self->dwarfDbgEsb->initEsbString(self, data, maxlen);
  }
  remaining = data->esbAllocatedSize - data->esbUsedBytes;
  if (remaining <= needed) {
    self->dwarfDbgEsb->esbAllocateMore(self, data,len);
  }
  strncpy(&data->esbString[data->esbUsedBytes], in_string, len);
  data->esbUsedBytes += len;
  data->esbString[data->esbUsedBytes] = 0;
  return TCL_OK;
}
static uint8_t esbAppendnInternal ( dwarfDbgPtr_t self , dwarfDbgEsb_t * data , const char * in_string , size_t len ) { size_t remaining = 0 ; size_t needed = len ; if ( data -> esbAllocatedSize == 0 ) { size_t maxlen = ( len >= allocSize ) ? ( len ) : allocSize ; self -> dwarfDbgEsb -> initEsbString ( self , data , maxlen ) ; } remaining = data -> esbAllocatedSize - data -> esbUsedBytes ; if ( remaining <= needed ) { self -> dwarfDbgEsb -> esbAllocateMore ( self , data , len ) ; } strncpy ( & data -> esbString [ data -> esbUsedBytes ] , in_string , len ) ; data -> esbUsedBytes += len ; data -> esbString [ data -> esbUsedBytes ] = 0 ; return TCL_OK ; }
The 'len' is believed.
The ' len ' is believed .
/*  ASSERT: data->esbAllocatedSize > data->esbUsedBytes  */ /* Insist on explicit NUL terminator */