~drizzle-trunk/drizzle/development

« back to all changes in this revision

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

  • Committer: pcrews
  • Date: 2011-05-24 17:36:24 UTC
  • mfrom: (1099.4.232 drizzle)
  • Revision ID: pcrews@lucid32-20110524173624-mwr1bvq6fa1r01ao
Updated translations + 2011.05.18 tarball tag

Show diffs side-by-side

added added

removed removed

Lines of Context:
36
36
 * are streaming enabled.
37
37
 *
38
38
 */
 
39
#pragma once
39
40
#ifndef __PBMS_H__
40
41
#define __PBMS_H__
41
42
 
161
162
        public:
162
163
        static bool couldBeURL(const char *blob_url, size_t size, MSBlobURLPtr blob)
163
164
        {
164
 
                if (blob_url && (size < PBMS_BLOB_URL_SIZE)) {
 
165
                if (blob_url && (size < PBMS_BLOB_URL_SIZE) && (size > 16)) {
165
166
                        MSBlobURLRec ignored_blob;
166
167
                        char    buffer[PBMS_BLOB_URL_SIZE+1];
167
168
                        char    junk[5];
171
172
                                blob = &ignored_blob;
172
173
                        
173
174
                        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
 
                        }
 
175
                        
 
176
                        // There is no guarantee that the URL will be null terminated
 
177
                        // so always copy it into our own buffer to be safe.
 
178
                        memcpy(buffer, blob_url, size);
 
179
                        buffer[size] = 0;
 
180
                        blob_url = buffer;
179
181
                        
180
182
                        scanned = sscanf(blob_url, URL_FMT"%4s", 
181
183
                                &blob->bu_db_id,