Mercurial > mplayer.hg
annotate asxparser.h @ 35394:7bad316da87a
stream ftp: Pass full buffer size to snprintf
Previously the buffer size was always passed as one less than
the underlying buffer's size. This is not using the underlying
buffer to its full potential according to the C99 standard. The
last byte of the buffers were never used.
No vulnerabilities should have been caused by this mistake because
the strings stored in the buffers were zero terminated at all
times. Neither were out-of-array writes nor reads possible.
author | al |
---|---|
date | Mon, 26 Nov 2012 23:36:00 +0000 |
parents | dd7f15a3fb1b |
children |
rev | line source |
---|---|
30429
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
29263
diff
changeset
|
1 /* |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
29263
diff
changeset
|
2 * This file is part of MPlayer. |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
29263
diff
changeset
|
3 * |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
29263
diff
changeset
|
4 * MPlayer is free software; you can redistribute it and/or modify |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
29263
diff
changeset
|
5 * it under the terms of the GNU General Public License as published by |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
29263
diff
changeset
|
6 * the Free Software Foundation; either version 2 of the License, or |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
29263
diff
changeset
|
7 * (at your option) any later version. |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
29263
diff
changeset
|
8 * |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
29263
diff
changeset
|
9 * MPlayer is distributed in the hope that it will be useful, |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
29263
diff
changeset
|
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
29263
diff
changeset
|
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
29263
diff
changeset
|
12 * GNU General Public License for more details. |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
29263
diff
changeset
|
13 * |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
29263
diff
changeset
|
14 * You should have received a copy of the GNU General Public License along |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
29263
diff
changeset
|
15 * with MPlayer; if not, write to the Free Software Foundation, Inc., |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
29263
diff
changeset
|
16 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
29263
diff
changeset
|
17 */ |
c1a3f1bbba26
Add license header to all top-level files missing them.
diego
parents:
29263
diff
changeset
|
18 |
26029 | 19 #ifndef MPLAYER_ASXPARSER_H |
20 #define MPLAYER_ASXPARSER_H | |
4043
25590564842f
tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff
changeset
|
21 |
30632
dad8e0eb182a
Add asx_parser_build_tree() to asxparser.h instead of forward declaring it.
diego
parents:
30429
diff
changeset
|
22 #include "playtree.h" |
dad8e0eb182a
Add asx_parser_build_tree() to asxparser.h instead of forward declaring it.
diego
parents:
30429
diff
changeset
|
23 |
25607
9d0b189ce1b2
Fix illegal identifiers: Names starting with __ or _ and uppercase are reserved
diego
parents:
25553
diff
changeset
|
24 typedef struct ASX_Parser_t ASX_Parser_t; |
4043
25590564842f
tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff
changeset
|
25 |
25590564842f
tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff
changeset
|
26 typedef struct { |
25590564842f
tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff
changeset
|
27 char* buffer; |
25590564842f
tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff
changeset
|
28 int line; |
25590564842f
tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff
changeset
|
29 } ASX_LineSave_t; |
25590564842f
tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff
changeset
|
30 |
25607
9d0b189ce1b2
Fix illegal identifiers: Names starting with __ or _ and uppercase are reserved
diego
parents:
25553
diff
changeset
|
31 struct ASX_Parser_t { |
4043
25590564842f
tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff
changeset
|
32 int line; // Curent line |
25590564842f
tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff
changeset
|
33 ASX_LineSave_t *ret_stack; |
25590564842f
tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff
changeset
|
34 int ret_stack_size; |
25590564842f
tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff
changeset
|
35 char* last_body; |
4309 | 36 int deep; |
4043
25590564842f
tree-based playlist parser code by Alban Bedel <albeu@free.fr>
arpi
parents:
diff
changeset
|
37 }; |
29263
0f1b5b68af32
whitespace cosmetics: Remove all trailing whitespace.
diego
parents:
26029
diff
changeset
|
38 |
8170 | 39 ASX_Parser_t* |
40 asx_parser_new(void); | |
41 | |
42 void | |
43 asx_parser_free(ASX_Parser_t* parser); | |
44 | |
45 /* | |
46 * Return -1 on error, 0 when nothing is found, 1 on sucess | |
47 */ | |
48 int | |
49 asx_get_element(ASX_Parser_t* parser,char** _buffer, | |
31077 | 50 char** _element,char** _body,char*** _attribs); |
8170 | 51 |
52 int | |
53 asx_parse_attribs(ASX_Parser_t* parser,char* buffer,char*** _attribs); | |
54 | |
55 /////// Attribs utils | |
56 | |
57 char* | |
19104
2ec2301183cd
marks several read-only string parameters which aren't modified inside the called function as const. Patch by Stefan Huehner, stefan AT huehner-org
reynaldo
parents:
19053
diff
changeset
|
58 asx_get_attrib(const char* attrib,char** attribs); |
8170 | 59 |
60 int | |
19053
75327b24e06f
marks several string parameters as const, as they are not modified inside the function, Patch by Stefan Huehner, stefan AT huehner-org
reynaldo
parents:
8170
diff
changeset
|
61 asx_attrib_to_enum(const char* val,char** valid_vals); |
8170 | 62 |
23609 | 63 #define asx_free_attribs(a) asx_list_free(&a,free) |
8170 | 64 |
65 ////// List utils | |
66 | |
67 typedef void (*ASX_FreeFunc)(void* arg); | |
68 | |
69 void | |
70 asx_list_free(void* list_ptr,ASX_FreeFunc free_func); | |
25553
6ac1ece1f9fe
Add multiple inclusion guards to all header files that lack them.
diego
parents:
23609
diff
changeset
|
71 |
30632
dad8e0eb182a
Add asx_parser_build_tree() to asxparser.h instead of forward declaring it.
diego
parents:
30429
diff
changeset
|
72 play_tree_t* |
dad8e0eb182a
Add asx_parser_build_tree() to asxparser.h instead of forward declaring it.
diego
parents:
30429
diff
changeset
|
73 asx_parser_build_tree(char* buffer,int deep); |
dad8e0eb182a
Add asx_parser_build_tree() to asxparser.h instead of forward declaring it.
diego
parents:
30429
diff
changeset
|
74 |
26029 | 75 #endif /* MPLAYER_ASXPARSER_H */ |