mirror of
https://gitlab.com/apparmor/apparmor
synced 2025-08-31 22:35:35 +00:00
libapparmor: Clarify that mode strings are not to be freed
The aa_getcon man page only implies that the *mode strings returned by aa_getprocattr(), aa_gettaskcon(), aa_getcon(), and aa_getpeercon() should not be freed. A developer using the man page to build against libapparmor may miss that subtlety and end up hitting double free issues. This patch makes the man page more clear, makes the function comments more clear, and changes the aa_getprocattr() *buf param to *con. The use of *buf should reserved for the aa_get*_raw() functions that do not allocate a buffer for the confinement context and all documents now clearly mention that *con must be freed. Additionally, this patch removes the line wrapping of the aa_getprocattr_raw() prototype in the aa_getcon man page source. The line wrapping caused incorrect formatting of the function prototype when viewing the man page. Signed-off-by: Tyler Hicks <tyhicks@canonical.com> Acked-by: Seth Arnold <seth.arnold@canonical.com>
This commit is contained in:
@@ -76,7 +76,7 @@ extern int (aa_change_hat_vargs)(unsigned long token, int count, ...);
|
||||
*/
|
||||
extern int aa_getprocattr_raw(pid_t tid, const char *attr, char *buf, int len,
|
||||
char **mode);
|
||||
extern int aa_getprocattr(pid_t tid, const char *attr, char **buf, char **mode);
|
||||
extern int aa_getprocattr(pid_t tid, const char *attr, char **con, char **mode);
|
||||
extern int aa_gettaskcon(pid_t target, char **con, char **mode);
|
||||
extern int aa_getcon(char **con, char **mode);
|
||||
extern int aa_getpeercon_raw(int fd, char *buf, int *len, char **mode);
|
||||
|
Reference in New Issue
Block a user