diff options
author | Jo-Philipp Wich <jow@openwrt.org> | 2009-04-06 18:16:04 +0000 |
---|---|---|
committer | Jo-Philipp Wich <jow@openwrt.org> | 2009-04-06 18:16:04 +0000 |
commit | bf1cbdd8389d5e7067b03c1f10e9fbcb3756ccf4 (patch) | |
tree | c17407058f43b580716608dadf4978122003b632 /contrib/lar/lar.c | |
parent | bfa91018ace069edf3deb6c7e0bbe235ed6ecd3f (diff) |
contrib/lar: fix buffer overflow check, define os dir seperator
Diffstat (limited to 'contrib/lar/lar.c')
-rw-r--r-- | contrib/lar/lar.c | 6 |
1 files changed, 3 insertions, 3 deletions
diff --git a/contrib/lar/lar.c b/contrib/lar/lar.c index ad6cfc8e5..839b29299 100644 --- a/contrib/lar/lar.c +++ b/contrib/lar/lar.c @@ -183,7 +183,7 @@ lar_archive * lar_find_archive( const char *package ) 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++; @@ -197,7 +197,7 @@ lar_archive * lar_find_archive( const char *package ) 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'; @@ -219,7 +219,7 @@ lar_member * lar_find_member( lar_archive *ar, const char *package ) 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]; |