* details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with these librararies and programs; if not, write
+ * License along with these libraries and programs; if not, write
* to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
* Floor, Boston, MA 02110-1301 USA
*/
return;
unsigned char event_type = *stream++;
- char *infobase;
+ int len, bufferlen;
char *locator; // NOTE: make fixed width and add "mmdb:" to
// front ? Should eventually go into calling
// program to determine doc type.
// Skip over the defunct infobase name.
// NOTE: It should be removed from the olias api. DJB
- infobase = (char *) stream;
while (*stream != '\0')
stream++;
stream++;
}
else
{
- char *buffer = new char[strlen("mmdb:LOCATOR=") + strlen(locator) + 1];
- sprintf (buffer, "mmdb:LOCATOR=%s", locator);
+ bufferlen = strlen("mmdb:LOCATOR=") + strlen(locator) + 1;
+ char *buffer = new char[bufferlen];
+ snprintf (buffer, bufferlen, "mmdb:LOCATOR=%s", locator);
d = UAS_Common::create (buffer);
- if (d != (const int)NULL)
+ if (d != (const int)0)
{
// (evil hack alert)
g_scroll_to_locator = TRUE;
- strcpy (g_top_locator, locator);
+ len = MIN(strlen(locator), 4096 - 1);
+ *((char *) memcpy(g_top_locator, locator, len) + len) = '\0';
}
delete [] buffer;
}
}
end_try;
- if (d != (const int)NULL)
+ if (d != (const int)0)
{
d->retrieve();
reply_to_client(client, OLIAS_SUCCESS);
{
char *buffer = NULL;
char *locator;
+ int len, bufferlen;
UAS_Pointer<UAS_Common> d;
switch (event->type)
}
else
{
- buffer = new char[strlen("mmdb:LOCATOR=") + strlen(locator) + 1];
- sprintf (buffer, "mmdb:LOCATOR=%s", locator);
+ bufferlen = strlen("mmdb:LOCATOR=") + strlen(locator) + 1;
+ buffer = new char[bufferlen];
+ snprintf (buffer, bufferlen, "mmdb:LOCATOR=%s", locator);
d = UAS_Common::create (buffer);
delete [] buffer;
- if (d != (const int)NULL)
+ if (d != (const int)0)
{
// (evil hack alert)
if (locator == NULL)
return (OLIAS_TIMEOUT);
- ON_DEBUG (printf (">>> g_top_locator = %p\n", g_top_locator));
- if (g_top_locator == NULL)
+ ON_DEBUG(printf(">>> g_top_locator = %p\n", g_top_locator));
+ if (g_top_locator[0] == '\0')
return (OLIAS_TIMEOUT);
g_scroll_to_locator = TRUE;
- strcpy (g_top_locator, locator);
+ len = MIN(strlen(locator), 4096 - 1);
+ *((char *) memcpy(g_top_locator, locator, len) +len) = '\0';
}
}
}
d = NULL;
}
end_try;
- if (d != (const int)NULL)
+ if (d != (const int)0)
{
d->retrieve();
return (OLIAS_SUCCESS);
default:
return (OLIAS_TIMEOUT);
}
+
+ return (OLIAS_LOCATOR_NOT_FOUND);
}