Namespace the lookup_enum function
[babeltrace.git] / formats / ctf / ctf.c
index 8029512a2745876f9ce19e9ce1fab725fb64ddf7..a8f8408910c0b32ab0931b3f9581f89d751227dd 100644 (file)
  *
  * The above copyright notice and this permission notice shall be included in
  * all copies or substantial portions of the Software.
+ *
+ * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+ * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+ * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
+ * SOFTWARE.
  */
 
 #include <babeltrace/format.h>
@@ -423,7 +431,7 @@ int ctf_read_event(struct stream_pos *ppos, struct ctf_stream_definition *stream
                } else {
                        struct definition_enum *enum_definition;
 
-                       enum_definition = lookup_enum(&stream->stream_event_header->p, "id", FALSE);
+                       enum_definition = bt_lookup_enum(&stream->stream_event_header->p, "id", FALSE);
                        if (enum_definition) {
                                id = enum_definition->integer->value._unsigned;
                        }
@@ -902,6 +910,9 @@ int ctf_open_trace_metadata_packet_read(struct ctf_trace *td, FILE *in,
                        return -EINVAL;
        }
 
+       if ((header.content_size / CHAR_BIT) < header_sizeof(header))
+               return -EINVAL;
+
        toread = (header.content_size / CHAR_BIT) - header_sizeof(header);
 
        for (;;) {
This page took 0.024181 seconds and 4 git commands to generate.