From 42cfffae80480eae4381902fff3f7c61f858a933 Mon Sep 17 00:00:00 2001 From: Jeremy Allison Date: Fri, 7 Dec 2007 17:32:32 -0800 Subject: 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) --- source3/registry/reg_db.c | 19 +++++++++++++------ 1 file changed, 13 insertions(+), 6 deletions(-) (limited to 'source3/registry/reg_db.c') 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; + } } } -- cgit