apr-bugs mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject [Bug 56477] New: Saving pointer pointer to string of unknown origin.
Date Wed, 30 Apr 2014 21:00:01 GMT
https://issues.apache.org/bugzilla/show_bug.cgi?id=56477

            Bug ID: 56477
           Summary: Saving pointer pointer to string of unknown origin.
           Product: APR
           Version: 1.5.0
          Hardware: PC
            Status: NEW
          Severity: normal
          Priority: P2
         Component: APR
          Assignee: bugs@apr.apache.org
          Reporter: Harry.Tongelidis@misys.com

In the file:
https://svn.apache.org/repos/asf/apr/apr/branches/1.6.x/locks/win32/proc_mutex.c

Function:
APR_DECLARE(apr_status_t) apr_proc_mutex_create(apr_proc_mutex_t **mutex,
                                                const char *fname,
                                                apr_lockmech_e mech,
                                                apr_pool_t *pool);

The pointer to the string passed to the function is stored in the newly created
structure. 
(*mutex)->fname = fname;

This is fine for static strings but strings on the stack or dynamically
allocated will point to garbage when (*mutex)->fname is accessed.

The structure pointer is accessed in the function: 
APR_DECLARE(const char *) apr_proc_mutex_lockfile(apr_proc_mutex_t *mutex);

My guess is that:
(*mutex)->fname = fname;

Should be:
(*mutex)->fname = mutexkey;
Or:
(*mutex)->fname = fname? apr_pstrdup(pool, fname) : NULL;

-- 
You are receiving this mail because:
You are the assignee for the bug.

---------------------------------------------------------------------
To unsubscribe, e-mail: bugs-unsubscribe@apr.apache.org
For additional commands, e-mail: bugs-help@apr.apache.org


Mime
View raw message