~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/pbms/src/pbms.h

  • Committer: Monty Taylor
  • Date: 2011-03-11 18:48:55 UTC
  • mfrom: (2228.1.8 build)
  • Revision ID: mordred@inaugust.com-20110311184855-1essd3a6xfr7lx6r
Merged Andrew: drizzledump and docs bug fixes
Merged Barry: pbms bugfixes

Show diffs side-by-side

added added

removed removed

Lines of Context:
161
161
        public:
162
162
        static bool couldBeURL(const char *blob_url, size_t size, MSBlobURLPtr blob)
163
163
        {
164
 
                if (blob_url && (size < PBMS_BLOB_URL_SIZE)) {
 
164
                if (blob_url && (size < PBMS_BLOB_URL_SIZE) && (size > 16)) {
165
165
                        MSBlobURLRec ignored_blob;
166
166
                        char    buffer[PBMS_BLOB_URL_SIZE+1];
167
167
                        char    junk[5];
171
171
                                blob = &ignored_blob;
172
172
                        
173
173
                        junk[0] = 0;
174
 
                        if (blob_url[size]) { // There is no guarantee that the URL will be null terminated.
175
 
                                memcpy(buffer, blob_url, size);
176
 
                                buffer[size] = 0;
177
 
                                blob_url = buffer;
178
 
                        }
 
174
                        
 
175
                        // There is no guarantee that the URL will be null terminated
 
176
                        // so always copy it into our own buffer to be safe.
 
177
                        memcpy(buffer, blob_url, size);
 
178
                        buffer[size] = 0;
 
179
                        blob_url = buffer;
179
180
                        
180
181
                        scanned = sscanf(blob_url, URL_FMT"%4s", 
181
182
                                &blob->bu_db_id,