~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to drizzled/sql_string.h

  • Committer: nlw
  • Date: 2009-05-22 09:00:33 UTC
  • mto: (1022.4.2 update-to-gcc-44)
  • mto: This revision was merged to the branch mainline in revision 1036.
  • Revision ID: nlw@orisndriz01-20090522090033-kxz3t1ceg95n2mys
Fix buffer overrun in string::c_ptr, now handles all cases properly

Show diffs side-by-side

added added

removed removed

Lines of Context:
122
122
  inline const char *ptr() const { return Ptr; }
123
123
  inline char *c_ptr()
124
124
  {
125
 
    if (!Ptr || *(Ptr + str_length))
 
125
    if (str_length == Alloced_length)
126
126
      (void) realloc(str_length);
 
127
    else
 
128
      Ptr[str_length]= 0;
 
129
    
127
130
    return Ptr;
128
131
  }
129
132
  inline char *c_ptr_quick()