Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 20 additions & 3 deletions common_modules/module_lib/src/txm_module_object_pointer_get.c
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,22 @@
#define TXM_MODULE
#include "txm_module.h"
#ifndef TXM_MODULE_OBJECT_POINTER_GET_CALL_NOT_USED

/* DEPRECATION NOTICE
* txm_module_object_pointer_get() is deprecated. Do not use it in new code.
*
* WHY: this function passes UINT_MAX as the name-buffer length to the
* underlying search. If the name pointer points to a buffer shorter than
* the searched string, the comparison can read past the end of the buffer,
* which is undefined behaviour.
*
* WHAT TO DO: replace calls with txm_module_object_pointer_get_extended(),
* passing the actual length of the name buffer as the third argument.
*/
#pragma message("txm_module_object_pointer_get() is deprecated. " \
"Use txm_module_object_pointer_get_extended() and pass " \
"the actual name buffer length.")

/**************************************************************************/
/* */
/* FUNCTION RELEASE */
Expand All @@ -35,9 +51,10 @@
/* */
/* DESCRIPTION */
/* */
/* This function is deprecated and calls the secure version of this */
/* function (_txm_module_manager_object_pointer_get_extended) with the */
/* maximum possible name length since none was passed. */
/* DEPRECATED. Use _txm_module_object_pointer_get_extended() instead, */
/* passing the actual name-buffer length. This wrapper passes */
/* UINT_MAX as the length, which can cause the name-comparison loop */
/* to read past the end of a short buffer (undefined behaviour). */
/* */
/* INPUT */
/* */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,9 +37,10 @@
/* */
/* DESCRIPTION */
/* */
/* This function is deprecated and calls the secure version of this */
/* function (_txm_module_manager_object_pointer_get_extended) with the */
/* maximum possible name length since none was passed. */
/* DEPRECATED. Use _txm_module_manager_object_pointer_get_extended() */
/* instead, passing the actual name-buffer length. This wrapper */
/* passes UINT_MAX as the length, which can cause the name-comparison */
/* loop to read past the end of a short buffer (undefined behaviour). */
/* */
/* INPUT */
/* */
Expand Down