]> git.sur5r.net Git - openldap/blobdiff - servers/slapd/ldapsync.c
make sure NULL pointers are not dereferenced
[openldap] / servers / slapd / ldapsync.c
index f4e80ac873efdbcae87dd429bdb0e3210b4cb187..7d9b9cf20e76bc1f7319cfdaa262973f8787c4c1 100644 (file)
@@ -2,7 +2,7 @@
 /* $OpenLDAP$ */
 /* This work is part of OpenLDAP Software <http://www.openldap.org/>.
  *
- * Copyright 2003-2005 The OpenLDAP Foundation.
+ * Copyright 2003-2006 The OpenLDAP Foundation.
  * Portions Copyright 2003 IBM Corporation.
  * All rights reserved.
  *
@@ -114,6 +114,9 @@ slap_parse_sync_cookie(
                return -1;
        }
 
+       if ( rid_ptr[ STRLENOF( "rid=" ) ] == '-' ) {
+               return -1;
+       }
        cookie->rid = strtoul( &rid_ptr[ STRLENOF( "rid=" ) ], &next, 10 );
        if ( next == &rid_ptr[ STRLENOF( "rid=" ) ] || ( next[ 0 ] != ',' && next[ 0 ] != '\0' ) ) {
                return -1;