[augeas-devel] Is aug_get safe for buffer overflow ?

James Antill james at fedoraproject.com
Thu Jun 5 18:12:26 UTC 2008


On Thu, 2008-06-05 at 19:08 +0200, Dominique Dumont wrote:
> Hello
> 
> I'm quite rusted in C, and I've finally managed to get aug_get working
> in the Perl bindings I'm working on.

 Indeed.

> After some trial and errors, I've realised that I need to allocate the
> char** passed to aug_get so that aug_set will store the data there.
> 
> In short:
> 
>     char* c_value[100]; // 100 is completely arbitrary
>     int ret = aug_get(aug,path,c_value);

 This is a bit confused, between points and buffers. This is basically
how aug_get() can be used:

    char *ret = NULL;
    int ret = aug_get(aug,path, &ret);

    if (ret == 1) puts(ret);

...aug_set() does take a "buffer" of char, but uses strdup() on it.

-- 
James Antill <james at fedoraproject.com>
Fedora




More information about the augeas-devel mailing list