for( len = 0; package[len] != '\0'; len++ )
{
- if( len >= sizeof(buffer) )
+ if( len >= (sizeof(buffer) - 5) )
LAR_DIE("Package name exceeds maximum allowed length");
if( package[len] == '.' ) seg++;
if( j < seg ) j++; else break;
}
- buffer[i] = ( package[i] == '.' ) ? '/' : package[i];
+ buffer[i] = ( package[i] == '.' ) ? LAR_DIRSEP : package[i];
}
buffer[i+0] = '.'; buffer[i+1] = 'l'; buffer[i+2] = 'a';
for( len = 0; package[len] != '\0'; len++ )
{
- if( len >= sizeof(buffer) )
+ if( len >= (sizeof(buffer) - 5) )
LAR_DIE("Package name exceeds maximum allowed length");
buffer[len] = ( package[len] == '.' ) ? '/' : package[len];
+#ifndef __LAR_H
+#define __LAR_H
+
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#define LAR_FNAME_BUFFER 1024
#define LAR_FNAME(s) char s[LAR_FNAME_BUFFER]
+#ifdef __WIN32__
+#define LAR_DIRSEP '\\'
+#else
+#define LAR_DIRSEP '/'
+#endif
+
struct lar_index_item {
uint32_t noffset;
lar_archive * lar_find_archive( const char *package );
lar_member * lar_find_member( lar_archive *ar, const char *package );
+
+#endif
+