summaryrefslogtreecommitdiff
path: root/src/sexp.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/sexp.c')
-rw-r--r--src/sexp.c9
1 files changed, 4 insertions, 5 deletions
diff --git a/src/sexp.c b/src/sexp.c
index aea3a5fa..bda2484f 100644
--- a/src/sexp.c
+++ b/src/sexp.c
@@ -383,7 +383,7 @@ gcry_sexp_find_token( const GCRY_SEXP list, const char *tok, size_t toklen )
}
/****************
- * return the length of the given list
+ * Return the length of the given list
*/
int
gcry_sexp_length( const GCRY_SEXP list )
@@ -401,14 +401,13 @@ gcry_sexp_length( const GCRY_SEXP list )
while ( (type=*p) != ST_STOP ) {
p++;
if ( type == ST_DATA ) {
- memcpy ( &n, ++p, sizeof n );
+ memcpy ( &n, p, sizeof n );
p += sizeof n + n;
- p--;
- if ( !level )
+ if ( level == 1 )
length++;
}
else if ( type == ST_OPEN ) {
- if ( !level )
+ if ( level == 1 )
length++;
level++;
}