diff options
author | Jeremy Allison <jra@samba.org> | 2007-12-07 17:32:32 -0800 |
---|---|---|
committer | Jeremy Allison <jra@samba.org> | 2007-12-07 17:32:32 -0800 |
commit | 42cfffae80480eae4381902fff3f7c61f858a933 (patch) | |
tree | 2fc1bc486fa988a4f2854310bcf91943db1aa566 /source3/registry | |
parent | 25288b0e4472c728fc5a3a70c6c3e1f621ffae5f (diff) | |
download | samba-42cfffae80480eae4381902fff3f7c61f858a933.tar.gz samba-42cfffae80480eae4381902fff3f7c61f858a933.tar.bz2 samba-42cfffae80480eae4381902fff3f7c61f858a933.zip |
Remove next_token - all uses must now be next_token_talloc.
No more temptations to use static length strings.
Jeremy.
(This used to be commit ec003f39369910dee852b7cafb883ddaa321c2de)
Diffstat (limited to 'source3/registry')
-rw-r--r-- | source3/registry/reg_db.c | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/source3/registry/reg_db.c b/source3/registry/reg_db.c index 7c4ea18b1e..12a37d10a1 100644 --- a/source3/registry/reg_db.c +++ b/source3/registry/reg_db.c @@ -89,7 +89,8 @@ static bool init_registry_data( void ) char *base = NULL; char *remaining = NULL; TALLOC_CTX *ctx = talloc_tos(); - fstring keyname, subkeyname; + char *keyname; + char *subkeyname; REGSUBKEY_CTR *subkeys; REGVAL_CTR *values; int i; @@ -125,7 +126,7 @@ static bool init_registry_data( void ) } p = path; - while (next_token(&p, keyname, "\\", sizeof(keyname))) { + while (next_token_talloc(ctx, &p, &keyname, "\\")) { /* build up the registry path from the components */ @@ -142,7 +143,10 @@ static bool init_registry_data( void ) /* get the immediate subkeyname (if we have one ) */ - *subkeyname = '\0'; + subkeyname = talloc_strdup(ctx, ""); + if (!subkeyname) { + goto fail; + } if (*p) { TALLOC_FREE(remaining); remaining = talloc_strdup(ctx, p); @@ -151,9 +155,12 @@ static bool init_registry_data( void ) } p2 = remaining; - if (!next_token(&p2, subkeyname, "\\", - sizeof(subkeyname))) { - fstrcpy( subkeyname, p2 ); + if (!next_token_talloc(ctx, &p2, + &subkeyname, "\\")) { + subkeyname = talloc_strdup(ctx,p2); + if (!subkeyname) { + goto fail; + } } } |