Changes of Revision 559
commit_531e301f4de5ecc294223393fc19d2a995b92379.txt
Deleted
commit_92515a9721b1fe60e347ecc153ead44d335d3dd3.txt
Added
open5gs_2.7.2.4565.531e.dsc -> open5gs_2.7.2.4566.9251.dsc
Changed
x
1
2
Source: open5gs
3
Binary: open5gs-common, open5gs-mme, open5gs-sgwc, open5gs-smf, open5gs-amf, open5gs-sgwu, open5gs-upf, open5gs-hss, open5gs-pcrf, open5gs-nrf, open5gs-scp, open5gs-sepp, open5gs-ausf, open5gs-udm, open5gs-pcf, open5gs-nssf, open5gs-bsf, open5gs-udr, open5gs, open5gs-dbg
4
Architecture: any
5
-Version: 2.7.2.4565.531e
6
+Version: 2.7.2.4566.9251
7
Maintainer: Harald Welte <laforge@gnumonks.org>
8
Uploaders: Sukchan Lee <acetcom@gmail.com>
9
Homepage: https://open5gs.org
10
11
open5gs-udr deb net optional arch=any
12
open5gs-upf deb net optional arch=any
13
Checksums-Sha1:
14
- 9efebd4f13cc239facf5e22fd45ea9df3d749e27 14513204 open5gs_2.7.2.4565.531e.tar.xz
15
+ c47a73ae6b42f7919124e5f82fc11e07e5fde6b3 14512112 open5gs_2.7.2.4566.9251.tar.xz
16
Checksums-Sha256:
17
- c425f50181f6cef56bdf6ef94c2a2d27367deae31aaea6a1f72ce4df747d2060 14513204 open5gs_2.7.2.4565.531e.tar.xz
18
+ 203614e20d765526ee2b15e3bd5d6c52ced5b55a7d50336b6cbbf0e8c078a9f9 14512112 open5gs_2.7.2.4566.9251.tar.xz
19
Files:
20
- e669277a5edd34ebb44c1040027395de 14513204 open5gs_2.7.2.4565.531e.tar.xz
21
+ 986b58927931359888f7600ead476ecf 14512112 open5gs_2.7.2.4566.9251.tar.xz
22
open5gs_2.7.2.4565.531e.tar.xz/.tarball-version -> open5gs_2.7.2.4566.9251.tar.xz/.tarball-version
Changed
4
1
2
-2.7.2.4565-531e
3
+2.7.2.4566-9251
4
open5gs_2.7.2.4565.531e.tar.xz/debian/changelog -> open5gs_2.7.2.4566.9251.tar.xz/debian/changelog
Changed
12
1
2
-open5gs (2.7.2.4565.531e) unstable; urgency=medium
3
+open5gs (2.7.2.4566.9251) unstable; urgency=medium
4
5
* Automatically generated changelog entry for building the Osmocom master feed
6
7
- -- Osmocom OBS scripts <info@osmocom.org> Wed, 11 Dec 2024 12:03:58 +0000
8
+ -- Osmocom OBS scripts <info@osmocom.org> Wed, 11 Dec 2024 12:27:42 +0000
9
10
open5gs (2.7.2) unstable; urgency=medium
11
12
open5gs_2.7.2.4565.531e.tar.xz/lib/nas/5gs/ies.c -> open5gs_2.7.2.4566.9251.tar.xz/lib/nas/5gs/ies.c
Changed
1466
1
2
/*******************************************************************************
3
* This file had been created by nas-message.py script v0.2.0
4
* Please do not modify this file but regenerate it via script.
5
- * Created on: 2024-01-21 18:47:47.812038 by acetcom
6
+ * Created on: 2024-12-11 21:13:08.097860 by acetcom
7
* from 24501-h90.docx
8
******************************************************************************/
9
10
11
int ogs_nas_5gs_decode_additional_information(ogs_nas_additional_information_t *additional_information, ogs_pkbuf_t *pkbuf)
12
{
13
int size = 0;
14
- ogs_nas_additional_information_t *source = (ogs_nas_additional_information_t *)pkbuf->data;
15
+ ogs_nas_additional_information_t *source = NULL;
16
+
17
+ if (pkbuf->len < 1) {
18
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
19
+ return -1;
20
+ }
21
+
22
+ source = (ogs_nas_additional_information_t *)pkbuf->data;
23
24
additional_information->length = source->length;
25
size = additional_information->length + sizeof(additional_information->length);
26
27
int ogs_nas_5gs_decode_service_level_aa_container(ogs_nas_service_level_aa_container_t *service_level_aa_container, ogs_pkbuf_t *pkbuf)
28
{
29
int size = 0;
30
- ogs_nas_service_level_aa_container_t *source = (ogs_nas_service_level_aa_container_t *)pkbuf->data;
31
+ ogs_nas_service_level_aa_container_t *source = NULL;
32
+
33
+ if (pkbuf->len < 2) {
34
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
35
+ return -1;
36
+ }
37
+
38
+ source = (ogs_nas_service_level_aa_container_t *)pkbuf->data;
39
40
service_level_aa_container->length = be16toh(source->length);
41
size = service_level_aa_container->length + sizeof(service_level_aa_container->length);
42
43
int ogs_nas_5gs_decode_dnn(ogs_nas_dnn_t *dnn, ogs_pkbuf_t *pkbuf)
44
{
45
int size = 0;
46
- ogs_nas_dnn_t *source = (ogs_nas_dnn_t *)pkbuf->data;
47
+ ogs_nas_dnn_t *source = NULL;
48
+
49
+ if (pkbuf->len < 1) {
50
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
51
+ return -1;
52
+ }
53
+
54
+ source = (ogs_nas_dnn_t *)pkbuf->data;
55
56
dnn->length = source->length;
57
size = dnn->length + sizeof(dnn->length);
58
59
int ogs_nas_5gs_decode_eap_message(ogs_nas_eap_message_t *eap_message, ogs_pkbuf_t *pkbuf)
60
{
61
int size = 0;
62
- ogs_nas_eap_message_t *source = (ogs_nas_eap_message_t *)pkbuf->data;
63
+ ogs_nas_eap_message_t *source = NULL;
64
+
65
+ if (pkbuf->len < 2) {
66
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
67
+ return -1;
68
+ }
69
+
70
+ source = (ogs_nas_eap_message_t *)pkbuf->data;
71
72
eap_message->length = be16toh(source->length);
73
size = eap_message->length + sizeof(eap_message->length);
74
75
int ogs_nas_5gs_decode_gprs_timer_2(ogs_nas_gprs_timer_2_t *gprs_timer_2, ogs_pkbuf_t *pkbuf)
76
{
77
int size = 0;
78
- ogs_nas_gprs_timer_2_t *source = (ogs_nas_gprs_timer_2_t *)pkbuf->data;
79
+ ogs_nas_gprs_timer_2_t *source = NULL;
80
+
81
+ if (pkbuf->len < 1) {
82
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
83
+ return -1;
84
+ }
85
+
86
+ source = (ogs_nas_gprs_timer_2_t *)pkbuf->data;
87
88
gprs_timer_2->length = source->length;
89
size = gprs_timer_2->length + sizeof(gprs_timer_2->length);
90
91
int ogs_nas_5gs_decode_gprs_timer_3(ogs_nas_gprs_timer_3_t *gprs_timer_3, ogs_pkbuf_t *pkbuf)
92
{
93
int size = 0;
94
- ogs_nas_gprs_timer_3_t *source = (ogs_nas_gprs_timer_3_t *)pkbuf->data;
95
+ ogs_nas_gprs_timer_3_t *source = NULL;
96
+
97
+ if (pkbuf->len < 1) {
98
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
99
+ return -1;
100
+ }
101
+
102
+ source = (ogs_nas_gprs_timer_3_t *)pkbuf->data;
103
104
gprs_timer_3->length = source->length;
105
size = gprs_timer_3->length + sizeof(gprs_timer_3->length);
106
107
int ogs_nas_5gs_decode_s_nssai(ogs_nas_s_nssai_t *s_nssai, ogs_pkbuf_t *pkbuf)
108
{
109
int size = 0;
110
- ogs_nas_s_nssai_t *source = (ogs_nas_s_nssai_t *)pkbuf->data;
111
+ ogs_nas_s_nssai_t *source = NULL;
112
+
113
+ if (pkbuf->len < 1) {
114
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
115
+ return -1;
116
+ }
117
+
118
+ source = (ogs_nas_s_nssai_t *)pkbuf->data;
119
120
s_nssai->length = source->length;
121
size = s_nssai->length + sizeof(s_nssai->length);
122
123
int ogs_nas_5gs_decode_5gmm_capability(ogs_nas_5gmm_capability_t *gmm_capability, ogs_pkbuf_t *pkbuf)
124
{
125
int size = 0;
126
- ogs_nas_5gmm_capability_t *source = (ogs_nas_5gmm_capability_t *)pkbuf->data;
127
+ ogs_nas_5gmm_capability_t *source = NULL;
128
+
129
+ if (pkbuf->len < 1) {
130
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
131
+ return -1;
132
+ }
133
+
134
+ source = (ogs_nas_5gmm_capability_t *)pkbuf->data;
135
136
gmm_capability->length = source->length;
137
size = gmm_capability->length + sizeof(gmm_capability->length);
138
139
int ogs_nas_5gs_decode_abba(ogs_nas_abba_t *abba, ogs_pkbuf_t *pkbuf)
140
{
141
int size = 0;
142
- ogs_nas_abba_t *source = (ogs_nas_abba_t *)pkbuf->data;
143
+ ogs_nas_abba_t *source = NULL;
144
+
145
+ if (pkbuf->len < 1) {
146
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
147
+ return -1;
148
+ }
149
+
150
+ source = (ogs_nas_abba_t *)pkbuf->data;
151
152
abba->length = source->length;
153
size = abba->length + sizeof(abba->length);
154
155
int ogs_nas_5gs_decode_additional_5g_security_information(ogs_nas_additional_5g_security_information_t *additional_security_information, ogs_pkbuf_t *pkbuf)
156
{
157
int size = 0;
158
- ogs_nas_additional_5g_security_information_t *source = (ogs_nas_additional_5g_security_information_t *)pkbuf->data;
159
+ ogs_nas_additional_5g_security_information_t *source = NULL;
160
+
161
+ if (pkbuf->len < 1) {
162
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
163
+ return -1;
164
+ }
165
+
166
+ source = (ogs_nas_additional_5g_security_information_t *)pkbuf->data;
167
168
additional_security_information->length = source->length;
169
size = additional_security_information->length + sizeof(additional_security_information->length);
170
171
int ogs_nas_5gs_decode_additional_information_requested(ogs_nas_additional_information_requested_t *additional_information_requested, ogs_pkbuf_t *pkbuf)
172
{
173
int size = 0;
174
- ogs_nas_additional_information_requested_t *source = (ogs_nas_additional_information_requested_t *)pkbuf->data;
175
+ ogs_nas_additional_information_requested_t *source = NULL;
176
+
177
+ if (pkbuf->len < 1) {
178
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
179
+ return -1;
180
+ }
181
+
182
+ source = (ogs_nas_additional_information_requested_t *)pkbuf->data;
183
184
additional_information_requested->length = source->length;
185
size = additional_information_requested->length + sizeof(additional_information_requested->length);
186
187
int ogs_nas_5gs_decode_allowed_pdu_session_status(ogs_nas_allowed_pdu_session_status_t *allowed_pdu_session_status, ogs_pkbuf_t *pkbuf)
188
{
189
int size = 0;
190
- ogs_nas_allowed_pdu_session_status_t *source = (ogs_nas_allowed_pdu_session_status_t *)pkbuf->data;
191
+ ogs_nas_allowed_pdu_session_status_t *source = NULL;
192
+
193
+ if (pkbuf->len < 1) {
194
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
195
+ return -1;
196
+ }
197
+
198
+ source = (ogs_nas_allowed_pdu_session_status_t *)pkbuf->data;
199
200
allowed_pdu_session_status->length = source->length;
201
size = allowed_pdu_session_status->length + sizeof(allowed_pdu_session_status->length);
202
203
int ogs_nas_5gs_decode_authentication_failure_parameter(ogs_nas_authentication_failure_parameter_t *authentication_failure_parameter, ogs_pkbuf_t *pkbuf)
204
{
205
int size = 0;
206
- ogs_nas_authentication_failure_parameter_t *source = (ogs_nas_authentication_failure_parameter_t *)pkbuf->data;
207
+ ogs_nas_authentication_failure_parameter_t *source = NULL;
208
+
209
+ if (pkbuf->len < 1) {
210
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
211
+ return -1;
212
+ }
213
+
214
+ source = (ogs_nas_authentication_failure_parameter_t *)pkbuf->data;
215
216
authentication_failure_parameter->length = source->length;
217
size = authentication_failure_parameter->length + sizeof(authentication_failure_parameter->length);
218
219
int ogs_nas_5gs_decode_authentication_parameter_autn(ogs_nas_authentication_parameter_autn_t *authentication_parameter_autn, ogs_pkbuf_t *pkbuf)
220
{
221
int size = 0;
222
- ogs_nas_authentication_parameter_autn_t *source = (ogs_nas_authentication_parameter_autn_t *)pkbuf->data;
223
+ ogs_nas_authentication_parameter_autn_t *source = NULL;
224
+
225
+ if (pkbuf->len < 1) {
226
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
227
+ return -1;
228
+ }
229
+
230
+ source = (ogs_nas_authentication_parameter_autn_t *)pkbuf->data;
231
232
authentication_parameter_autn->length = source->length;
233
size = authentication_parameter_autn->length + sizeof(authentication_parameter_autn->length);
234
235
int ogs_nas_5gs_decode_authentication_response_parameter(ogs_nas_authentication_response_parameter_t *authentication_response_parameter, ogs_pkbuf_t *pkbuf)
236
{
237
int size = 0;
238
- ogs_nas_authentication_response_parameter_t *source = (ogs_nas_authentication_response_parameter_t *)pkbuf->data;
239
+ ogs_nas_authentication_response_parameter_t *source = NULL;
240
+
241
+ if (pkbuf->len < 1) {
242
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
243
+ return -1;
244
+ }
245
+
246
+ source = (ogs_nas_authentication_response_parameter_t *)pkbuf->data;
247
248
authentication_response_parameter->length = source->length;
249
size = authentication_response_parameter->length + sizeof(authentication_response_parameter->length);
250
251
int ogs_nas_5gs_decode_cag_information_list(ogs_nas_cag_information_list_t *cag_information_list, ogs_pkbuf_t *pkbuf)
252
{
253
int size = 0;
254
- ogs_nas_cag_information_list_t *source = (ogs_nas_cag_information_list_t *)pkbuf->data;
255
+ ogs_nas_cag_information_list_t *source = NULL;
256
+
257
+ if (pkbuf->len < 2) {
258
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
259
+ return -1;
260
+ }
261
+
262
+ source = (ogs_nas_cag_information_list_t *)pkbuf->data;
263
264
cag_information_list->length = be16toh(source->length);
265
size = cag_information_list->length + sizeof(cag_information_list->length);
266
267
int ogs_nas_5gs_decode_ciphering_key_data(ogs_nas_ciphering_key_data_t *ciphering_key_data, ogs_pkbuf_t *pkbuf)
268
{
269
int size = 0;
270
- ogs_nas_ciphering_key_data_t *source = (ogs_nas_ciphering_key_data_t *)pkbuf->data;
271
+ ogs_nas_ciphering_key_data_t *source = NULL;
272
+
273
+ if (pkbuf->len < 2) {
274
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
275
+ return -1;
276
+ }
277
+
278
+ source = (ogs_nas_ciphering_key_data_t *)pkbuf->data;
279
280
ciphering_key_data->length = be16toh(source->length);
281
size = ciphering_key_data->length + sizeof(ciphering_key_data->length);
282
283
int ogs_nas_5gs_decode_daylight_saving_time(ogs_nas_daylight_saving_time_t *daylight_saving_time, ogs_pkbuf_t *pkbuf)
284
{
285
int size = 0;
286
- ogs_nas_daylight_saving_time_t *source = (ogs_nas_daylight_saving_time_t *)pkbuf->data;
287
+ ogs_nas_daylight_saving_time_t *source = NULL;
288
+
289
+ if (pkbuf->len < 1) {
290
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
291
+ return -1;
292
+ }
293
+
294
+ source = (ogs_nas_daylight_saving_time_t *)pkbuf->data;
295
296
daylight_saving_time->length = source->length;
297
size = daylight_saving_time->length + sizeof(daylight_saving_time->length);
298
299
int ogs_nas_5gs_decode_emergency_number_list(ogs_nas_emergency_number_list_t *emergency_number_list, ogs_pkbuf_t *pkbuf)
300
{
301
int size = 0;
302
- ogs_nas_emergency_number_list_t *source = (ogs_nas_emergency_number_list_t *)pkbuf->data;
303
+ ogs_nas_emergency_number_list_t *source = NULL;
304
+
305
+ if (pkbuf->len < 1) {
306
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
307
+ return -1;
308
+ }
309
+
310
+ source = (ogs_nas_emergency_number_list_t *)pkbuf->data;
311
312
emergency_number_list->length = source->length;
313
size = emergency_number_list->length + sizeof(emergency_number_list->length);
314
315
int ogs_nas_5gs_decode_eps_bearer_context_status(ogs_nas_eps_bearer_context_status_t *eps_bearer_context_status, ogs_pkbuf_t *pkbuf)
316
{
317
int size = 0;
318
- ogs_nas_eps_bearer_context_status_t *source = (ogs_nas_eps_bearer_context_status_t *)pkbuf->data;
319
+ ogs_nas_eps_bearer_context_status_t *source = NULL;
320
+
321
+ if (pkbuf->len < 1) {
322
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
323
+ return -1;
324
+ }
325
+
326
+ source = (ogs_nas_eps_bearer_context_status_t *)pkbuf->data;
327
328
eps_bearer_context_status->length = source->length;
329
size = eps_bearer_context_status->length + sizeof(eps_bearer_context_status->length);
330
331
int ogs_nas_5gs_decode_eps_nas_message_container(ogs_nas_eps_nas_message_container_t *eps_nas_message_container, ogs_pkbuf_t *pkbuf)
332
{
333
int size = 0;
334
- ogs_nas_eps_nas_message_container_t *source = (ogs_nas_eps_nas_message_container_t *)pkbuf->data;
335
+ ogs_nas_eps_nas_message_container_t *source = NULL;
336
+
337
+ if (pkbuf->len < 2) {
338
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
339
+ return -1;
340
+ }
341
+
342
+ source = (ogs_nas_eps_nas_message_container_t *)pkbuf->data;
343
344
eps_nas_message_container->length = be16toh(source->length);
345
size = eps_nas_message_container->length + sizeof(eps_nas_message_container->length);
346
347
int ogs_nas_5gs_decode_extended_emergency_number_list(ogs_nas_extended_emergency_number_list_t *extended_emergency_number_list, ogs_pkbuf_t *pkbuf)
348
{
349
int size = 0;
350
- ogs_nas_extended_emergency_number_list_t *source = (ogs_nas_extended_emergency_number_list_t *)pkbuf->data;
351
+ ogs_nas_extended_emergency_number_list_t *source = NULL;
352
+
353
+ if (pkbuf->len < 2) {
354
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
355
+ return -1;
356
+ }
357
+
358
+ source = (ogs_nas_extended_emergency_number_list_t *)pkbuf->data;
359
360
extended_emergency_number_list->length = be16toh(source->length);
361
size = extended_emergency_number_list->length + sizeof(extended_emergency_number_list->length);
362
363
int ogs_nas_5gs_decode_extended_drx_parameters(ogs_nas_extended_drx_parameters_t *extended_drx_parameters, ogs_pkbuf_t *pkbuf)
364
{
365
int size = 0;
366
- ogs_nas_extended_drx_parameters_t *source = (ogs_nas_extended_drx_parameters_t *)pkbuf->data;
367
+ ogs_nas_extended_drx_parameters_t *source = NULL;
368
+
369
+ if (pkbuf->len < 1) {
370
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
371
+ return -1;
372
+ }
373
+
374
+ source = (ogs_nas_extended_drx_parameters_t *)pkbuf->data;
375
376
extended_drx_parameters->length = source->length;
377
size = extended_drx_parameters->length + sizeof(extended_drx_parameters->length);
378
379
int ogs_nas_5gs_decode_ladn_indication(ogs_nas_ladn_indication_t *ladn_indication, ogs_pkbuf_t *pkbuf)
380
{
381
int size = 0;
382
- ogs_nas_ladn_indication_t *source = (ogs_nas_ladn_indication_t *)pkbuf->data;
383
+ ogs_nas_ladn_indication_t *source = NULL;
384
+
385
+ if (pkbuf->len < 2) {
386
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
387
+ return -1;
388
+ }
389
+
390
+ source = (ogs_nas_ladn_indication_t *)pkbuf->data;
391
392
ladn_indication->length = be16toh(source->length);
393
size = ladn_indication->length + sizeof(ladn_indication->length);
394
395
int ogs_nas_5gs_decode_5gs_drx_parameters(ogs_nas_5gs_drx_parameters_t *drx_parameters, ogs_pkbuf_t *pkbuf)
396
{
397
int size = 0;
398
- ogs_nas_5gs_drx_parameters_t *source = (ogs_nas_5gs_drx_parameters_t *)pkbuf->data;
399
+ ogs_nas_5gs_drx_parameters_t *source = NULL;
400
+
401
+ if (pkbuf->len < 1) {
402
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
403
+ return -1;
404
+ }
405
+
406
+ source = (ogs_nas_5gs_drx_parameters_t *)pkbuf->data;
407
408
drx_parameters->length = source->length;
409
size = drx_parameters->length + sizeof(drx_parameters->length);
410
411
int ogs_nas_5gs_decode_ladn_information(ogs_nas_ladn_information_t *ladn_information, ogs_pkbuf_t *pkbuf)
412
{
413
int size = 0;
414
- ogs_nas_ladn_information_t *source = (ogs_nas_ladn_information_t *)pkbuf->data;
415
+ ogs_nas_ladn_information_t *source = NULL;
416
+
417
+ if (pkbuf->len < 2) {
418
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
419
+ return -1;
420
+ }
421
+
422
+ source = (ogs_nas_ladn_information_t *)pkbuf->data;
423
424
ladn_information->length = be16toh(source->length);
425
size = ladn_information->length + sizeof(ladn_information->length);
426
427
int ogs_nas_5gs_decode_mapped_nssai(ogs_nas_mapped_nssai_t *mapped_nssai, ogs_pkbuf_t *pkbuf)
428
{
429
int size = 0;
430
- ogs_nas_mapped_nssai_t *source = (ogs_nas_mapped_nssai_t *)pkbuf->data;
431
+ ogs_nas_mapped_nssai_t *source = NULL;
432
+
433
+ if (pkbuf->len < 1) {
434
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
435
+ return -1;
436
+ }
437
+
438
+ source = (ogs_nas_mapped_nssai_t *)pkbuf->data;
439
440
mapped_nssai->length = source->length;
441
size = mapped_nssai->length + sizeof(mapped_nssai->length);
442
443
int ogs_nas_5gs_decode_mobile_station_classmark_2(ogs_nas_mobile_station_classmark_2_t *mobile_station_classmark_2, ogs_pkbuf_t *pkbuf)
444
{
445
int size = 0;
446
- ogs_nas_mobile_station_classmark_2_t *source = (ogs_nas_mobile_station_classmark_2_t *)pkbuf->data;
447
+ ogs_nas_mobile_station_classmark_2_t *source = NULL;
448
+
449
+ if (pkbuf->len < 1) {
450
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
451
+ return -1;
452
+ }
453
+
454
+ source = (ogs_nas_mobile_station_classmark_2_t *)pkbuf->data;
455
456
mobile_station_classmark_2->length = source->length;
457
size = mobile_station_classmark_2->length + sizeof(mobile_station_classmark_2->length);
458
459
int ogs_nas_5gs_decode_message_container(ogs_nas_message_container_t *message_container, ogs_pkbuf_t *pkbuf)
460
{
461
int size = 0;
462
- ogs_nas_message_container_t *source = (ogs_nas_message_container_t *)pkbuf->data;
463
+ ogs_nas_message_container_t *source = NULL;
464
+
465
+ if (pkbuf->len < 2) {
466
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
467
+ return -1;
468
+ }
469
+
470
+ source = (ogs_nas_message_container_t *)pkbuf->data;
471
472
message_container->length = be16toh(source->length);
473
size = message_container->length + sizeof(message_container->length);
474
475
int ogs_nas_5gs_decode_network_name(ogs_nas_network_name_t *network_name, ogs_pkbuf_t *pkbuf)
476
{
477
int size = 0;
478
- ogs_nas_network_name_t *source = (ogs_nas_network_name_t *)pkbuf->data;
479
+ ogs_nas_network_name_t *source = NULL;
480
+
481
+ if (pkbuf->len < 1) {
482
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
483
+ return -1;
484
+ }
485
+
486
+ source = (ogs_nas_network_name_t *)pkbuf->data;
487
488
network_name->length = source->length;
489
size = network_name->length + sizeof(network_name->length);
490
491
int ogs_nas_5gs_decode_nssai(ogs_nas_nssai_t *nssai, ogs_pkbuf_t *pkbuf)
492
{
493
int size = 0;
494
- ogs_nas_nssai_t *source = (ogs_nas_nssai_t *)pkbuf->data;
495
+ ogs_nas_nssai_t *source = NULL;
496
+
497
+ if (pkbuf->len < 1) {
498
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
499
+ return -1;
500
+ }
501
+
502
+ source = (ogs_nas_nssai_t *)pkbuf->data;
503
504
nssai->length = source->length;
505
size = nssai->length + sizeof(nssai->length);
506
507
int ogs_nas_5gs_decode_operator_defined_access_category_definitions(ogs_nas_operator_defined_access_category_definitions_t *operator_defined_access_category_definitions, ogs_pkbuf_t *pkbuf)
508
{
509
int size = 0;
510
- ogs_nas_operator_defined_access_category_definitions_t *source = (ogs_nas_operator_defined_access_category_definitions_t *)pkbuf->data;
511
+ ogs_nas_operator_defined_access_category_definitions_t *source = NULL;
512
+
513
+ if (pkbuf->len < 2) {
514
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
515
+ return -1;
516
+ }
517
+
518
+ source = (ogs_nas_operator_defined_access_category_definitions_t *)pkbuf->data;
519
520
operator_defined_access_category_definitions->length = be16toh(source->length);
521
size = operator_defined_access_category_definitions->length + sizeof(operator_defined_access_category_definitions->length);
522
523
int ogs_nas_5gs_decode_payload_container(ogs_nas_payload_container_t *payload_container, ogs_pkbuf_t *pkbuf)
524
{
525
int size = 0;
526
- ogs_nas_payload_container_t *source = (ogs_nas_payload_container_t *)pkbuf->data;
527
+ ogs_nas_payload_container_t *source = NULL;
528
+
529
+ if (pkbuf->len < 2) {
530
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
531
+ return -1;
532
+ }
533
+
534
+ source = (ogs_nas_payload_container_t *)pkbuf->data;
535
536
payload_container->length = be16toh(source->length);
537
size = payload_container->length + sizeof(payload_container->length);
538
539
int ogs_nas_5gs_decode_5gs_mobile_identity(ogs_nas_5gs_mobile_identity_t *mobile_identity, ogs_pkbuf_t *pkbuf)
540
{
541
int size = 0;
542
- ogs_nas_5gs_mobile_identity_t *source = (ogs_nas_5gs_mobile_identity_t *)pkbuf->data;
543
+ ogs_nas_5gs_mobile_identity_t *source = NULL;
544
+
545
+ if (pkbuf->len < 2) {
546
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
547
+ return -1;
548
+ }
549
+
550
+ source = (ogs_nas_5gs_mobile_identity_t *)pkbuf->data;
551
552
mobile_identity->length = be16toh(source->length);
553
size = mobile_identity->length + sizeof(mobile_identity->length);
554
555
int ogs_nas_5gs_decode_pdu_session_reactivation_result(ogs_nas_pdu_session_reactivation_result_t *pdu_session_reactivation_result, ogs_pkbuf_t *pkbuf)
556
{
557
int size = 0;
558
- ogs_nas_pdu_session_reactivation_result_t *source = (ogs_nas_pdu_session_reactivation_result_t *)pkbuf->data;
559
+ ogs_nas_pdu_session_reactivation_result_t *source = NULL;
560
+
561
+ if (pkbuf->len < 1) {
562
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
563
+ return -1;
564
+ }
565
+
566
+ source = (ogs_nas_pdu_session_reactivation_result_t *)pkbuf->data;
567
568
pdu_session_reactivation_result->length = source->length;
569
size = pdu_session_reactivation_result->length + sizeof(pdu_session_reactivation_result->length);
570
571
int ogs_nas_5gs_decode_pdu_session_reactivation_result_error_cause(ogs_nas_pdu_session_reactivation_result_error_cause_t *pdu_session_reactivation_result_error_cause, ogs_pkbuf_t *pkbuf)
572
{
573
int size = 0;
574
- ogs_nas_pdu_session_reactivation_result_error_cause_t *source = (ogs_nas_pdu_session_reactivation_result_error_cause_t *)pkbuf->data;
575
+ ogs_nas_pdu_session_reactivation_result_error_cause_t *source = NULL;
576
+
577
+ if (pkbuf->len < 2) {
578
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
579
+ return -1;
580
+ }
581
+
582
+ source = (ogs_nas_pdu_session_reactivation_result_error_cause_t *)pkbuf->data;
583
584
pdu_session_reactivation_result_error_cause->length = be16toh(source->length);
585
size = pdu_session_reactivation_result_error_cause->length + sizeof(pdu_session_reactivation_result_error_cause->length);
586
587
int ogs_nas_5gs_decode_pdu_session_status(ogs_nas_pdu_session_status_t *pdu_session_status, ogs_pkbuf_t *pkbuf)
588
{
589
int size = 0;
590
- ogs_nas_pdu_session_status_t *source = (ogs_nas_pdu_session_status_t *)pkbuf->data;
591
+ ogs_nas_pdu_session_status_t *source = NULL;
592
+
593
+ if (pkbuf->len < 1) {
594
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
595
+ return -1;
596
+ }
597
+
598
+ source = (ogs_nas_pdu_session_status_t *)pkbuf->data;
599
600
pdu_session_status->length = source->length;
601
size = pdu_session_status->length + sizeof(pdu_session_status->length);
602
603
int ogs_nas_5gs_decode_plmn_list(ogs_nas_plmn_list_t *plmn_list, ogs_pkbuf_t *pkbuf)
604
{
605
int size = 0;
606
- ogs_nas_plmn_list_t *source = (ogs_nas_plmn_list_t *)pkbuf->data;
607
+ ogs_nas_plmn_list_t *source = NULL;
608
+
609
+ if (pkbuf->len < 1) {
610
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
611
+ return -1;
612
+ }
613
+
614
+ source = (ogs_nas_plmn_list_t *)pkbuf->data;
615
616
plmn_list->length = source->length;
617
size = plmn_list->length + sizeof(plmn_list->length);
618
619
int ogs_nas_5gs_decode_rejected_nssai(ogs_nas_rejected_nssai_t *rejected_nssai, ogs_pkbuf_t *pkbuf)
620
{
621
int size = 0;
622
- ogs_nas_rejected_nssai_t *source = (ogs_nas_rejected_nssai_t *)pkbuf->data;
623
+ ogs_nas_rejected_nssai_t *source = NULL;
624
+
625
+ if (pkbuf->len < 1) {
626
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
627
+ return -1;
628
+ }
629
+
630
+ source = (ogs_nas_rejected_nssai_t *)pkbuf->data;
631
632
rejected_nssai->length = source->length;
633
size = rejected_nssai->length + sizeof(rejected_nssai->length);
634
635
int ogs_nas_5gs_decode_s1_ue_network_capability(ogs_nas_s1_ue_network_capability_t *s1_ue_network_capability, ogs_pkbuf_t *pkbuf)
636
{
637
int size = 0;
638
- ogs_nas_s1_ue_network_capability_t *source = (ogs_nas_s1_ue_network_capability_t *)pkbuf->data;
639
+ ogs_nas_s1_ue_network_capability_t *source = NULL;
640
+
641
+ if (pkbuf->len < 1) {
642
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
643
+ return -1;
644
+ }
645
+
646
+ source = (ogs_nas_s1_ue_network_capability_t *)pkbuf->data;
647
648
s1_ue_network_capability->length = source->length;
649
size = s1_ue_network_capability->length + sizeof(s1_ue_network_capability->length);
650
651
int ogs_nas_5gs_decode_s1_ue_security_capability(ogs_nas_s1_ue_security_capability_t *s1_ue_security_capability, ogs_pkbuf_t *pkbuf)
652
{
653
int size = 0;
654
- ogs_nas_s1_ue_security_capability_t *source = (ogs_nas_s1_ue_security_capability_t *)pkbuf->data;
655
+ ogs_nas_s1_ue_security_capability_t *source = NULL;
656
+
657
+ if (pkbuf->len < 1) {
658
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
659
+ return -1;
660
+ }
661
+
662
+ source = (ogs_nas_s1_ue_security_capability_t *)pkbuf->data;
663
664
s1_ue_security_capability->length = source->length;
665
size = s1_ue_security_capability->length + sizeof(s1_ue_security_capability->length);
666
667
int ogs_nas_5gs_decode_service_area_list(ogs_nas_service_area_list_t *service_area_list, ogs_pkbuf_t *pkbuf)
668
{
669
int size = 0;
670
- ogs_nas_service_area_list_t *source = (ogs_nas_service_area_list_t *)pkbuf->data;
671
+ ogs_nas_service_area_list_t *source = NULL;
672
+
673
+ if (pkbuf->len < 1) {
674
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
675
+ return -1;
676
+ }
677
+
678
+ source = (ogs_nas_service_area_list_t *)pkbuf->data;
679
680
service_area_list->length = source->length;
681
size = service_area_list->length + sizeof(service_area_list->length);
682
683
int ogs_nas_5gs_decode_5gs_network_feature_support(ogs_nas_5gs_network_feature_support_t *network_feature_support, ogs_pkbuf_t *pkbuf)
684
{
685
int size = 0;
686
- ogs_nas_5gs_network_feature_support_t *source = (ogs_nas_5gs_network_feature_support_t *)pkbuf->data;
687
+ ogs_nas_5gs_network_feature_support_t *source = NULL;
688
+
689
+ if (pkbuf->len < 1) {
690
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
691
+ return -1;
692
+ }
693
+
694
+ source = (ogs_nas_5gs_network_feature_support_t *)pkbuf->data;
695
696
network_feature_support->length = source->length;
697
size = network_feature_support->length + sizeof(network_feature_support->length);
698
699
int ogs_nas_5gs_decode_sor_transparent_container(ogs_nas_sor_transparent_container_t *sor_transparent_container, ogs_pkbuf_t *pkbuf)
700
{
701
int size = 0;
702
- ogs_nas_sor_transparent_container_t *source = (ogs_nas_sor_transparent_container_t *)pkbuf->data;
703
+ ogs_nas_sor_transparent_container_t *source = NULL;
704
+
705
+ if (pkbuf->len < 2) {
706
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
707
+ return -1;
708
+ }
709
+
710
+ source = (ogs_nas_sor_transparent_container_t *)pkbuf->data;
711
712
sor_transparent_container->length = be16toh(source->length);
713
size = sor_transparent_container->length + sizeof(sor_transparent_container->length);
714
715
int ogs_nas_5gs_decode_supported_codec_list(ogs_nas_supported_codec_list_t *supported_codec_list, ogs_pkbuf_t *pkbuf)
716
{
717
int size = 0;
718
- ogs_nas_supported_codec_list_t *source = (ogs_nas_supported_codec_list_t *)pkbuf->data;
719
+ ogs_nas_supported_codec_list_t *source = NULL;
720
+
721
+ if (pkbuf->len < 1) {
722
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
723
+ return -1;
724
+ }
725
+
726
+ source = (ogs_nas_supported_codec_list_t *)pkbuf->data;
727
728
supported_codec_list->length = source->length;
729
size = supported_codec_list->length + sizeof(supported_codec_list->length);
730
731
int ogs_nas_5gs_decode_ue_security_capability(ogs_nas_ue_security_capability_t *ue_security_capability, ogs_pkbuf_t *pkbuf)
732
{
733
int size = 0;
734
- ogs_nas_ue_security_capability_t *source = (ogs_nas_ue_security_capability_t *)pkbuf->data;
735
+ ogs_nas_ue_security_capability_t *source = NULL;
736
+
737
+ if (pkbuf->len < 1) {
738
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
739
+ return -1;
740
+ }
741
+
742
+ source = (ogs_nas_ue_security_capability_t *)pkbuf->data;
743
744
ue_security_capability->length = source->length;
745
size = ue_security_capability->length + sizeof(ue_security_capability->length);
746
747
int ogs_nas_5gs_decode_ue_usage_setting(ogs_nas_ue_usage_setting_t *ue_usage_setting, ogs_pkbuf_t *pkbuf)
748
{
749
int size = 0;
750
- ogs_nas_ue_usage_setting_t *source = (ogs_nas_ue_usage_setting_t *)pkbuf->data;
751
+ ogs_nas_ue_usage_setting_t *source = NULL;
752
+
753
+ if (pkbuf->len < 1) {
754
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
755
+ return -1;
756
+ }
757
+
758
+ source = (ogs_nas_ue_usage_setting_t *)pkbuf->data;
759
760
ue_usage_setting->length = source->length;
761
size = ue_usage_setting->length + sizeof(ue_usage_setting->length);
762
763
int ogs_nas_5gs_decode_ue_status(ogs_nas_ue_status_t *ue_status, ogs_pkbuf_t *pkbuf)
764
{
765
int size = 0;
766
- ogs_nas_ue_status_t *source = (ogs_nas_ue_status_t *)pkbuf->data;
767
+ ogs_nas_ue_status_t *source = NULL;
768
+
769
+ if (pkbuf->len < 1) {
770
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
771
+ return -1;
772
+ }
773
+
774
+ source = (ogs_nas_ue_status_t *)pkbuf->data;
775
776
ue_status->length = source->length;
777
size = ue_status->length + sizeof(ue_status->length);
778
779
int ogs_nas_5gs_decode_uplink_data_status(ogs_nas_uplink_data_status_t *uplink_data_status, ogs_pkbuf_t *pkbuf)
780
{
781
int size = 0;
782
- ogs_nas_uplink_data_status_t *source = (ogs_nas_uplink_data_status_t *)pkbuf->data;
783
+ ogs_nas_uplink_data_status_t *source = NULL;
784
+
785
+ if (pkbuf->len < 1) {
786
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
787
+ return -1;
788
+ }
789
+
790
+ source = (ogs_nas_uplink_data_status_t *)pkbuf->data;
791
792
uplink_data_status->length = source->length;
793
size = uplink_data_status->length + sizeof(uplink_data_status->length);
794
795
int ogs_nas_5gs_decode_5gs_registration_result(ogs_nas_5gs_registration_result_t *registration_result, ogs_pkbuf_t *pkbuf)
796
{
797
int size = 0;
798
- ogs_nas_5gs_registration_result_t *source = (ogs_nas_5gs_registration_result_t *)pkbuf->data;
799
+ ogs_nas_5gs_registration_result_t *source = NULL;
800
+
801
+ if (pkbuf->len < 1) {
802
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
803
+ return -1;
804
+ }
805
+
806
+ source = (ogs_nas_5gs_registration_result_t *)pkbuf->data;
807
808
registration_result->length = source->length;
809
size = registration_result->length + sizeof(registration_result->length);
810
811
int ogs_nas_5gs_decode_ue_radio_capability_id(ogs_nas_ue_radio_capability_id_t *ue_radio_capability_id, ogs_pkbuf_t *pkbuf)
812
{
813
int size = 0;
814
- ogs_nas_ue_radio_capability_id_t *source = (ogs_nas_ue_radio_capability_id_t *)pkbuf->data;
815
+ ogs_nas_ue_radio_capability_id_t *source = NULL;
816
+
817
+ if (pkbuf->len < 1) {
818
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
819
+ return -1;
820
+ }
821
+
822
+ source = (ogs_nas_ue_radio_capability_id_t *)pkbuf->data;
823
824
ue_radio_capability_id->length = source->length;
825
size = ue_radio_capability_id->length + sizeof(ue_radio_capability_id->length);
826
827
int ogs_nas_5gs_decode_truncated_5g_s_tmsi_configuration(ogs_nas_truncated_5g_s_tmsi_configuration_t *truncated_s_tmsi_configuration, ogs_pkbuf_t *pkbuf)
828
{
829
int size = 0;
830
- ogs_nas_truncated_5g_s_tmsi_configuration_t *source = (ogs_nas_truncated_5g_s_tmsi_configuration_t *)pkbuf->data;
831
+ ogs_nas_truncated_5g_s_tmsi_configuration_t *source = NULL;
832
+
833
+ if (pkbuf->len < 1) {
834
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
835
+ return -1;
836
+ }
837
+
838
+ source = (ogs_nas_truncated_5g_s_tmsi_configuration_t *)pkbuf->data;
839
840
truncated_s_tmsi_configuration->length = source->length;
841
size = truncated_s_tmsi_configuration->length + sizeof(truncated_s_tmsi_configuration->length);
842
843
int ogs_nas_5gs_decode_wus_assistance_information(ogs_nas_wus_assistance_information_t *wus_assistance_information, ogs_pkbuf_t *pkbuf)
844
{
845
int size = 0;
846
- ogs_nas_wus_assistance_information_t *source = (ogs_nas_wus_assistance_information_t *)pkbuf->data;
847
+ ogs_nas_wus_assistance_information_t *source = NULL;
848
+
849
+ if (pkbuf->len < 1) {
850
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
851
+ return -1;
852
+ }
853
+
854
+ source = (ogs_nas_wus_assistance_information_t *)pkbuf->data;
855
856
wus_assistance_information->length = source->length;
857
size = wus_assistance_information->length + sizeof(wus_assistance_information->length);
858
859
int ogs_nas_5gs_decode_nb_n1_mode_drx_parameters(ogs_nas_nb_n1_mode_drx_parameters_t *nb_n1_mode_drx_parameters, ogs_pkbuf_t *pkbuf)
860
{
861
int size = 0;
862
- ogs_nas_nb_n1_mode_drx_parameters_t *source = (ogs_nas_nb_n1_mode_drx_parameters_t *)pkbuf->data;
863
+ ogs_nas_nb_n1_mode_drx_parameters_t *source = NULL;
864
+
865
+ if (pkbuf->len < 1) {
866
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
867
+ return -1;
868
+ }
869
+
870
+ source = (ogs_nas_nb_n1_mode_drx_parameters_t *)pkbuf->data;
871
872
nb_n1_mode_drx_parameters->length = source->length;
873
size = nb_n1_mode_drx_parameters->length + sizeof(nb_n1_mode_drx_parameters->length);
874
875
int ogs_nas_5gs_decode_extended_rejected_nssai(ogs_nas_extended_rejected_nssai_t *extended_rejected_nssai, ogs_pkbuf_t *pkbuf)
876
{
877
int size = 0;
878
- ogs_nas_extended_rejected_nssai_t *source = (ogs_nas_extended_rejected_nssai_t *)pkbuf->data;
879
+ ogs_nas_extended_rejected_nssai_t *source = NULL;
880
+
881
+ if (pkbuf->len < 1) {
882
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
883
+ return -1;
884
+ }
885
+
886
+ source = (ogs_nas_extended_rejected_nssai_t *)pkbuf->data;
887
888
extended_rejected_nssai->length = source->length;
889
size = extended_rejected_nssai->length + sizeof(extended_rejected_nssai->length);
890
891
int ogs_nas_5gs_decode_ue_request_type(ogs_nas_ue_request_type_t *ue_request_type, ogs_pkbuf_t *pkbuf)
892
{
893
int size = 0;
894
- ogs_nas_ue_request_type_t *source = (ogs_nas_ue_request_type_t *)pkbuf->data;
895
+ ogs_nas_ue_request_type_t *source = NULL;
896
+
897
+ if (pkbuf->len < 1) {
898
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
899
+ return -1;
900
+ }
901
+
902
+ source = (ogs_nas_ue_request_type_t *)pkbuf->data;
903
904
ue_request_type->length = source->length;
905
size = ue_request_type->length + sizeof(ue_request_type->length);
906
907
int ogs_nas_5gs_decode_paging_restriction(ogs_nas_paging_restriction_t *paging_restriction, ogs_pkbuf_t *pkbuf)
908
{
909
int size = 0;
910
- ogs_nas_paging_restriction_t *source = (ogs_nas_paging_restriction_t *)pkbuf->data;
911
+ ogs_nas_paging_restriction_t *source = NULL;
912
+
913
+ if (pkbuf->len < 1) {
914
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
915
+ return -1;
916
+ }
917
+
918
+ source = (ogs_nas_paging_restriction_t *)pkbuf->data;
919
920
paging_restriction->length = source->length;
921
size = paging_restriction->length + sizeof(paging_restriction->length);
922
923
int ogs_nas_5gs_decode_nid(ogs_nas_nid_t *nid, ogs_pkbuf_t *pkbuf)
924
{
925
int size = 0;
926
- ogs_nas_nid_t *source = (ogs_nas_nid_t *)pkbuf->data;
927
+ ogs_nas_nid_t *source = NULL;
928
+
929
+ if (pkbuf->len < 1) {
930
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
931
+ return -1;
932
+ }
933
+
934
+ source = (ogs_nas_nid_t *)pkbuf->data;
935
936
nid->length = source->length;
937
size = nid->length + sizeof(nid->length);
938
939
int ogs_nas_5gs_decode_peips_assistance_information(ogs_nas_peips_assistance_information_t *peips_assistance_information, ogs_pkbuf_t *pkbuf)
940
{
941
int size = 0;
942
- ogs_nas_peips_assistance_information_t *source = (ogs_nas_peips_assistance_information_t *)pkbuf->data;
943
+ ogs_nas_peips_assistance_information_t *source = NULL;
944
+
945
+ if (pkbuf->len < 1) {
946
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
947
+ return -1;
948
+ }
949
+
950
+ source = (ogs_nas_peips_assistance_information_t *)pkbuf->data;
951
952
peips_assistance_information->length = source->length;
953
size = peips_assistance_information->length + sizeof(peips_assistance_information->length);
954
955
int ogs_nas_5gs_decode_5gs_additional_request_result(ogs_nas_5gs_additional_request_result_t *additional_request_result, ogs_pkbuf_t *pkbuf)
956
{
957
int size = 0;
958
- ogs_nas_5gs_additional_request_result_t *source = (ogs_nas_5gs_additional_request_result_t *)pkbuf->data;
959
+ ogs_nas_5gs_additional_request_result_t *source = NULL;
960
+
961
+ if (pkbuf->len < 1) {
962
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
963
+ return -1;
964
+ }
965
+
966
+ source = (ogs_nas_5gs_additional_request_result_t *)pkbuf->data;
967
968
additional_request_result->length = source->length;
969
size = additional_request_result->length + sizeof(additional_request_result->length);
970
971
int ogs_nas_5gs_decode_nssrg_information(ogs_nas_nssrg_information_t *nssrg_information, ogs_pkbuf_t *pkbuf)
972
{
973
int size = 0;
974
- ogs_nas_nssrg_information_t *source = (ogs_nas_nssrg_information_t *)pkbuf->data;
975
+ ogs_nas_nssrg_information_t *source = NULL;
976
+
977
+ if (pkbuf->len < 2) {
978
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
979
+ return -1;
980
+ }
981
+
982
+ source = (ogs_nas_nssrg_information_t *)pkbuf->data;
983
984
nssrg_information->length = be16toh(source->length);
985
size = nssrg_information->length + sizeof(nssrg_information->length);
986
987
int ogs_nas_5gs_decode_list_of_plmns_to_be_used_in_disaster_condition(ogs_nas_list_of_plmns_to_be_used_in_disaster_condition_t *list_of_plmns_to_be_used_in_disaster_condition, ogs_pkbuf_t *pkbuf)
988
{
989
int size = 0;
990
- ogs_nas_list_of_plmns_to_be_used_in_disaster_condition_t *source = (ogs_nas_list_of_plmns_to_be_used_in_disaster_condition_t *)pkbuf->data;
991
+ ogs_nas_list_of_plmns_to_be_used_in_disaster_condition_t *source = NULL;
992
+
993
+ if (pkbuf->len < 1) {
994
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
995
+ return -1;
996
+ }
997
+
998
+ source = (ogs_nas_list_of_plmns_to_be_used_in_disaster_condition_t *)pkbuf->data;
999
1000
list_of_plmns_to_be_used_in_disaster_condition->length = source->length;
1001
size = list_of_plmns_to_be_used_in_disaster_condition->length + sizeof(list_of_plmns_to_be_used_in_disaster_condition->length);
1002
1003
int ogs_nas_5gs_decode_registration_wait_range(ogs_nas_registration_wait_range_t *registration_wait_range, ogs_pkbuf_t *pkbuf)
1004
{
1005
int size = 0;
1006
- ogs_nas_registration_wait_range_t *source = (ogs_nas_registration_wait_range_t *)pkbuf->data;
1007
+ ogs_nas_registration_wait_range_t *source = NULL;
1008
+
1009
+ if (pkbuf->len < 1) {
1010
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
1011
+ return -1;
1012
+ }
1013
+
1014
+ source = (ogs_nas_registration_wait_range_t *)pkbuf->data;
1015
1016
registration_wait_range->length = source->length;
1017
size = registration_wait_range->length + sizeof(registration_wait_range->length);
1018
1019
int ogs_nas_5gs_decode_plmn_identity(ogs_nas_plmn_identity_t *plmn_identity, ogs_pkbuf_t *pkbuf)
1020
{
1021
int size = 0;
1022
- ogs_nas_plmn_identity_t *source = (ogs_nas_plmn_identity_t *)pkbuf->data;
1023
+ ogs_nas_plmn_identity_t *source = NULL;
1024
+
1025
+ if (pkbuf->len < 1) {
1026
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
1027
+ return -1;
1028
+ }
1029
+
1030
+ source = (ogs_nas_plmn_identity_t *)pkbuf->data;
1031
1032
plmn_identity->length = source->length;
1033
size = plmn_identity->length + sizeof(plmn_identity->length);
1034
1035
int ogs_nas_5gs_decode_extended_cag_information_list(ogs_nas_extended_cag_information_list_t *extended_cag_information_list, ogs_pkbuf_t *pkbuf)
1036
{
1037
int size = 0;
1038
- ogs_nas_extended_cag_information_list_t *source = (ogs_nas_extended_cag_information_list_t *)pkbuf->data;
1039
+ ogs_nas_extended_cag_information_list_t *source = NULL;
1040
+
1041
+ if (pkbuf->len < 2) {
1042
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
1043
+ return -1;
1044
+ }
1045
+
1046
+ source = (ogs_nas_extended_cag_information_list_t *)pkbuf->data;
1047
1048
extended_cag_information_list->length = be16toh(source->length);
1049
size = extended_cag_information_list->length + sizeof(extended_cag_information_list->length);
1050
1051
int ogs_nas_5gs_decode_nsag_information(ogs_nas_nsag_information_t *nsag_information, ogs_pkbuf_t *pkbuf)
1052
{
1053
int size = 0;
1054
- ogs_nas_nsag_information_t *source = (ogs_nas_nsag_information_t *)pkbuf->data;
1055
+ ogs_nas_nsag_information_t *source = NULL;
1056
+
1057
+ if (pkbuf->len < 2) {
1058
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
1059
+ return -1;
1060
+ }
1061
+
1062
+ source = (ogs_nas_nsag_information_t *)pkbuf->data;
1063
1064
nsag_information->length = be16toh(source->length);
1065
size = nsag_information->length + sizeof(nsag_information->length);
1066
1067
int ogs_nas_5gs_decode_5gs_tracking_area_identity_list(ogs_nas_5gs_tracking_area_identity_list_t *tracking_area_identity_list, ogs_pkbuf_t *pkbuf)
1068
{
1069
int size = 0;
1070
- ogs_nas_5gs_tracking_area_identity_list_t *source = (ogs_nas_5gs_tracking_area_identity_list_t *)pkbuf->data;
1071
+ ogs_nas_5gs_tracking_area_identity_list_t *source = NULL;
1072
+
1073
+ if (pkbuf->len < 1) {
1074
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
1075
+ return -1;
1076
+ }
1077
+
1078
+ source = (ogs_nas_5gs_tracking_area_identity_list_t *)pkbuf->data;
1079
1080
tracking_area_identity_list->length = source->length;
1081
size = tracking_area_identity_list->length + sizeof(tracking_area_identity_list->length);
1082
1083
int ogs_nas_5gs_decode_5gs_update_type(ogs_nas_5gs_update_type_t *update_type, ogs_pkbuf_t *pkbuf)
1084
{
1085
int size = 0;
1086
- ogs_nas_5gs_update_type_t *source = (ogs_nas_5gs_update_type_t *)pkbuf->data;
1087
+ ogs_nas_5gs_update_type_t *source = NULL;
1088
+
1089
+ if (pkbuf->len < 1) {
1090
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
1091
+ return -1;
1092
+ }
1093
+
1094
+ source = (ogs_nas_5gs_update_type_t *)pkbuf->data;
1095
1096
update_type->length = source->length;
1097
size = update_type->length + sizeof(update_type->length);
1098
1099
int ogs_nas_5gs_decode_5gsm_capability(ogs_nas_5gsm_capability_t *gsm_capability, ogs_pkbuf_t *pkbuf)
1100
{
1101
int size = 0;
1102
- ogs_nas_5gsm_capability_t *source = (ogs_nas_5gsm_capability_t *)pkbuf->data;
1103
+ ogs_nas_5gsm_capability_t *source = NULL;
1104
+
1105
+ if (pkbuf->len < 1) {
1106
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
1107
+ return -1;
1108
+ }
1109
+
1110
+ source = (ogs_nas_5gsm_capability_t *)pkbuf->data;
1111
1112
gsm_capability->length = source->length;
1113
size = gsm_capability->length + sizeof(gsm_capability->length);
1114
1115
int ogs_nas_5gs_decode_pdu_address(ogs_nas_pdu_address_t *pdu_address, ogs_pkbuf_t *pkbuf)
1116
{
1117
int size = 0;
1118
- ogs_nas_pdu_address_t *source = (ogs_nas_pdu_address_t *)pkbuf->data;
1119
+ ogs_nas_pdu_address_t *source = NULL;
1120
+
1121
+ if (pkbuf->len < 1) {
1122
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
1123
+ return -1;
1124
+ }
1125
+
1126
+ source = (ogs_nas_pdu_address_t *)pkbuf->data;
1127
1128
pdu_address->length = source->length;
1129
size = pdu_address->length + sizeof(pdu_address->length);
1130
1131
int ogs_nas_5gs_decode_qos_flow_descriptions(ogs_nas_qos_flow_descriptions_t *qos_flow_descriptions, ogs_pkbuf_t *pkbuf)
1132
{
1133
int size = 0;
1134
- ogs_nas_qos_flow_descriptions_t *source = (ogs_nas_qos_flow_descriptions_t *)pkbuf->data;
1135
+ ogs_nas_qos_flow_descriptions_t *source = NULL;
1136
+
1137
+ if (pkbuf->len < 2) {
1138
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
1139
+ return -1;
1140
+ }
1141
+
1142
+ source = (ogs_nas_qos_flow_descriptions_t *)pkbuf->data;
1143
1144
qos_flow_descriptions->length = be16toh(source->length);
1145
size = qos_flow_descriptions->length + sizeof(qos_flow_descriptions->length);
1146
1147
int ogs_nas_5gs_decode_qos_rules(ogs_nas_qos_rules_t *qos_rules, ogs_pkbuf_t *pkbuf)
1148
{
1149
int size = 0;
1150
- ogs_nas_qos_rules_t *source = (ogs_nas_qos_rules_t *)pkbuf->data;
1151
+ ogs_nas_qos_rules_t *source = NULL;
1152
+
1153
+ if (pkbuf->len < 2) {
1154
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
1155
+ return -1;
1156
+ }
1157
+
1158
+ source = (ogs_nas_qos_rules_t *)pkbuf->data;
1159
1160
qos_rules->length = be16toh(source->length);
1161
size = qos_rules->length + sizeof(qos_rules->length);
1162
1163
int ogs_nas_5gs_decode_session_ambr(ogs_nas_session_ambr_t *session_ambr, ogs_pkbuf_t *pkbuf)
1164
{
1165
int size = 0;
1166
- ogs_nas_session_ambr_t *source = (ogs_nas_session_ambr_t *)pkbuf->data;
1167
+ ogs_nas_session_ambr_t *source = NULL;
1168
+
1169
+ if (pkbuf->len < 1) {
1170
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
1171
+ return -1;
1172
+ }
1173
+
1174
+ source = (ogs_nas_session_ambr_t *)pkbuf->data;
1175
1176
session_ambr->length = source->length;
1177
size = session_ambr->length + sizeof(session_ambr->length);
1178
1179
int ogs_nas_5gs_decode_sm_pdu_dn_request_container(ogs_nas_sm_pdu_dn_request_container_t *sm_pdu_dn_request_container, ogs_pkbuf_t *pkbuf)
1180
{
1181
int size = 0;
1182
- ogs_nas_sm_pdu_dn_request_container_t *source = (ogs_nas_sm_pdu_dn_request_container_t *)pkbuf->data;
1183
+ ogs_nas_sm_pdu_dn_request_container_t *source = NULL;
1184
+
1185
+ if (pkbuf->len < 1) {
1186
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
1187
+ return -1;
1188
+ }
1189
+
1190
+ source = (ogs_nas_sm_pdu_dn_request_container_t *)pkbuf->data;
1191
1192
sm_pdu_dn_request_container->length = source->length;
1193
size = sm_pdu_dn_request_container->length + sizeof(sm_pdu_dn_request_container->length);
1194
1195
int ogs_nas_5gs_decode_re_attempt_indicator(ogs_nas_re_attempt_indicator_t *re_attempt_indicator, ogs_pkbuf_t *pkbuf)
1196
{
1197
int size = 0;
1198
- ogs_nas_re_attempt_indicator_t *source = (ogs_nas_re_attempt_indicator_t *)pkbuf->data;
1199
+ ogs_nas_re_attempt_indicator_t *source = NULL;
1200
+
1201
+ if (pkbuf->len < 1) {
1202
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
1203
+ return -1;
1204
+ }
1205
+
1206
+ source = (ogs_nas_re_attempt_indicator_t *)pkbuf->data;
1207
1208
re_attempt_indicator->length = source->length;
1209
size = re_attempt_indicator->length + sizeof(re_attempt_indicator->length);
1210
1211
int ogs_nas_5gs_decode_5gsm_network_feature_support(ogs_nas_5gsm_network_feature_support_t *gsm_network_feature_support, ogs_pkbuf_t *pkbuf)
1212
{
1213
int size = 0;
1214
- ogs_nas_5gsm_network_feature_support_t *source = (ogs_nas_5gsm_network_feature_support_t *)pkbuf->data;
1215
+ ogs_nas_5gsm_network_feature_support_t *source = NULL;
1216
+
1217
+ if (pkbuf->len < 1) {
1218
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
1219
+ return -1;
1220
+ }
1221
+
1222
+ source = (ogs_nas_5gsm_network_feature_support_t *)pkbuf->data;
1223
1224
gsm_network_feature_support->length = source->length;
1225
size = gsm_network_feature_support->length + sizeof(gsm_network_feature_support->length);
1226
1227
int ogs_nas_5gs_decode_serving_plmn_rate_control(ogs_nas_serving_plmn_rate_control_t *serving_plmn_rate_control, ogs_pkbuf_t *pkbuf)
1228
{
1229
int size = 0;
1230
- ogs_nas_serving_plmn_rate_control_t *source = (ogs_nas_serving_plmn_rate_control_t *)pkbuf->data;
1231
+ ogs_nas_serving_plmn_rate_control_t *source = NULL;
1232
+
1233
+ if (pkbuf->len < 1) {
1234
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
1235
+ return -1;
1236
+ }
1237
+
1238
+ source = (ogs_nas_serving_plmn_rate_control_t *)pkbuf->data;
1239
1240
serving_plmn_rate_control->length = source->length;
1241
size = serving_plmn_rate_control->length + sizeof(serving_plmn_rate_control->length);
1242
1243
int ogs_nas_5gs_decode_5gsm_congestion_re_attempt_indicator(ogs_nas_5gsm_congestion_re_attempt_indicator_t *gsm_congestion_re_attempt_indicator, ogs_pkbuf_t *pkbuf)
1244
{
1245
int size = 0;
1246
- ogs_nas_5gsm_congestion_re_attempt_indicator_t *source = (ogs_nas_5gsm_congestion_re_attempt_indicator_t *)pkbuf->data;
1247
+ ogs_nas_5gsm_congestion_re_attempt_indicator_t *source = NULL;
1248
+
1249
+ if (pkbuf->len < 1) {
1250
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
1251
+ return -1;
1252
+ }
1253
+
1254
+ source = (ogs_nas_5gsm_congestion_re_attempt_indicator_t *)pkbuf->data;
1255
1256
gsm_congestion_re_attempt_indicator->length = source->length;
1257
size = gsm_congestion_re_attempt_indicator->length + sizeof(gsm_congestion_re_attempt_indicator->length);
1258
1259
int ogs_nas_5gs_decode_atsss_container(ogs_nas_atsss_container_t *atsss_container, ogs_pkbuf_t *pkbuf)
1260
{
1261
int size = 0;
1262
- ogs_nas_atsss_container_t *source = (ogs_nas_atsss_container_t *)pkbuf->data;
1263
+ ogs_nas_atsss_container_t *source = NULL;
1264
+
1265
+ if (pkbuf->len < 2) {
1266
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
1267
+ return -1;
1268
+ }
1269
+
1270
+ source = (ogs_nas_atsss_container_t *)pkbuf->data;
1271
1272
atsss_container->length = be16toh(source->length);
1273
size = atsss_container->length + sizeof(atsss_container->length);
1274
1275
int ogs_nas_5gs_decode_ip_header_compression_configuration(ogs_nas_ip_header_compression_configuration_t *ip_header_compression_configuration, ogs_pkbuf_t *pkbuf)
1276
{
1277
int size = 0;
1278
- ogs_nas_ip_header_compression_configuration_t *source = (ogs_nas_ip_header_compression_configuration_t *)pkbuf->data;
1279
+ ogs_nas_ip_header_compression_configuration_t *source = NULL;
1280
+
1281
+ if (pkbuf->len < 1) {
1282
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
1283
+ return -1;
1284
+ }
1285
+
1286
+ source = (ogs_nas_ip_header_compression_configuration_t *)pkbuf->data;
1287
1288
ip_header_compression_configuration->length = source->length;
1289
size = ip_header_compression_configuration->length + sizeof(ip_header_compression_configuration->length);
1290
1291
int ogs_nas_5gs_decode_header_compression_configuration(ogs_nas_header_compression_configuration_t *header_compression_configuration, ogs_pkbuf_t *pkbuf)
1292
{
1293
int size = 0;
1294
- ogs_nas_header_compression_configuration_t *source = (ogs_nas_header_compression_configuration_t *)pkbuf->data;
1295
+ ogs_nas_header_compression_configuration_t *source = NULL;
1296
+
1297
+ if (pkbuf->len < 1) {
1298
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
1299
+ return -1;
1300
+ }
1301
+
1302
+ source = (ogs_nas_header_compression_configuration_t *)pkbuf->data;
1303
1304
header_compression_configuration->length = source->length;
1305
size = header_compression_configuration->length + sizeof(header_compression_configuration->length);
1306
1307
int ogs_nas_5gs_decode_ds_tt_ethernet_port_mac_address(ogs_nas_ds_tt_ethernet_port_mac_address_t *ds_tt_ethernet_port_mac_address, ogs_pkbuf_t *pkbuf)
1308
{
1309
int size = 0;
1310
- ogs_nas_ds_tt_ethernet_port_mac_address_t *source = (ogs_nas_ds_tt_ethernet_port_mac_address_t *)pkbuf->data;
1311
+ ogs_nas_ds_tt_ethernet_port_mac_address_t *source = NULL;
1312
+
1313
+ if (pkbuf->len < 1) {
1314
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
1315
+ return -1;
1316
+ }
1317
+
1318
+ source = (ogs_nas_ds_tt_ethernet_port_mac_address_t *)pkbuf->data;
1319
1320
ds_tt_ethernet_port_mac_address->length = source->length;
1321
size = ds_tt_ethernet_port_mac_address->length + sizeof(ds_tt_ethernet_port_mac_address->length);
1322
1323
int ogs_nas_5gs_decode_ue_ds_tt_residence_time(ogs_nas_ue_ds_tt_residence_time_t *ue_ds_tt_residence_time, ogs_pkbuf_t *pkbuf)
1324
{
1325
int size = 0;
1326
- ogs_nas_ue_ds_tt_residence_time_t *source = (ogs_nas_ue_ds_tt_residence_time_t *)pkbuf->data;
1327
+ ogs_nas_ue_ds_tt_residence_time_t *source = NULL;
1328
+
1329
+ if (pkbuf->len < 1) {
1330
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
1331
+ return -1;
1332
+ }
1333
+
1334
+ source = (ogs_nas_ue_ds_tt_residence_time_t *)pkbuf->data;
1335
1336
ue_ds_tt_residence_time->length = source->length;
1337
size = ue_ds_tt_residence_time->length + sizeof(ue_ds_tt_residence_time->length);
1338
1339
int ogs_nas_5gs_decode_port_management_information_container(ogs_nas_port_management_information_container_t *port_management_information_container, ogs_pkbuf_t *pkbuf)
1340
{
1341
int size = 0;
1342
- ogs_nas_port_management_information_container_t *source = (ogs_nas_port_management_information_container_t *)pkbuf->data;
1343
+ ogs_nas_port_management_information_container_t *source = NULL;
1344
+
1345
+ if (pkbuf->len < 2) {
1346
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
1347
+ return -1;
1348
+ }
1349
+
1350
+ source = (ogs_nas_port_management_information_container_t *)pkbuf->data;
1351
1352
port_management_information_container->length = be16toh(source->length);
1353
size = port_management_information_container->length + sizeof(port_management_information_container->length);
1354
1355
int ogs_nas_5gs_decode_ethernet_header_compression_configuration(ogs_nas_ethernet_header_compression_configuration_t *ethernet_header_compression_configuration, ogs_pkbuf_t *pkbuf)
1356
{
1357
int size = 0;
1358
- ogs_nas_ethernet_header_compression_configuration_t *source = (ogs_nas_ethernet_header_compression_configuration_t *)pkbuf->data;
1359
+ ogs_nas_ethernet_header_compression_configuration_t *source = NULL;
1360
+
1361
+ if (pkbuf->len < 1) {
1362
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
1363
+ return -1;
1364
+ }
1365
+
1366
+ source = (ogs_nas_ethernet_header_compression_configuration_t *)pkbuf->data;
1367
1368
ethernet_header_compression_configuration->length = source->length;
1369
size = ethernet_header_compression_configuration->length + sizeof(ethernet_header_compression_configuration->length);
1370
1371
int ogs_nas_5gs_decode_requested_mbs_container(ogs_nas_requested_mbs_container_t *requested_mbs_container, ogs_pkbuf_t *pkbuf)
1372
{
1373
int size = 0;
1374
- ogs_nas_requested_mbs_container_t *source = (ogs_nas_requested_mbs_container_t *)pkbuf->data;
1375
+ ogs_nas_requested_mbs_container_t *source = NULL;
1376
+
1377
+ if (pkbuf->len < 2) {
1378
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
1379
+ return -1;
1380
+ }
1381
+
1382
+ source = (ogs_nas_requested_mbs_container_t *)pkbuf->data;
1383
1384
requested_mbs_container->length = be16toh(source->length);
1385
size = requested_mbs_container->length + sizeof(requested_mbs_container->length);
1386
1387
int ogs_nas_5gs_decode_received_mbs_container(ogs_nas_received_mbs_container_t *received_mbs_container, ogs_pkbuf_t *pkbuf)
1388
{
1389
int size = 0;
1390
- ogs_nas_received_mbs_container_t *source = (ogs_nas_received_mbs_container_t *)pkbuf->data;
1391
+ ogs_nas_received_mbs_container_t *source = NULL;
1392
+
1393
+ if (pkbuf->len < 2) {
1394
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
1395
+ return -1;
1396
+ }
1397
+
1398
+ source = (ogs_nas_received_mbs_container_t *)pkbuf->data;
1399
1400
received_mbs_container->length = be16toh(source->length);
1401
size = received_mbs_container->length + sizeof(received_mbs_container->length);
1402
1403
int ogs_nas_5gs_decode_pdu_session_pair_id(ogs_nas_pdu_session_pair_id_t *pdu_session_pair_id, ogs_pkbuf_t *pkbuf)
1404
{
1405
int size = 0;
1406
- ogs_nas_pdu_session_pair_id_t *source = (ogs_nas_pdu_session_pair_id_t *)pkbuf->data;
1407
+ ogs_nas_pdu_session_pair_id_t *source = NULL;
1408
+
1409
+ if (pkbuf->len < 1) {
1410
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
1411
+ return -1;
1412
+ }
1413
+
1414
+ source = (ogs_nas_pdu_session_pair_id_t *)pkbuf->data;
1415
1416
pdu_session_pair_id->length = source->length;
1417
size = pdu_session_pair_id->length + sizeof(pdu_session_pair_id->length);
1418
1419
int ogs_nas_5gs_decode_rsn(ogs_nas_rsn_t *rsn, ogs_pkbuf_t *pkbuf)
1420
{
1421
int size = 0;
1422
- ogs_nas_rsn_t *source = (ogs_nas_rsn_t *)pkbuf->data;
1423
+ ogs_nas_rsn_t *source = NULL;
1424
+
1425
+ if (pkbuf->len < 1) {
1426
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
1427
+ return -1;
1428
+ }
1429
+
1430
+ source = (ogs_nas_rsn_t *)pkbuf->data;
1431
1432
rsn->length = source->length;
1433
size = rsn->length + sizeof(rsn->length);
1434
1435
int ogs_nas_5gs_decode_extended_protocol_configuration_options(ogs_nas_extended_protocol_configuration_options_t *extended_protocol_configuration_options, ogs_pkbuf_t *pkbuf)
1436
{
1437
int size = 0;
1438
- ogs_nas_extended_protocol_configuration_options_t *source = (ogs_nas_extended_protocol_configuration_options_t *)pkbuf->data;
1439
+ ogs_nas_extended_protocol_configuration_options_t *source = NULL;
1440
+
1441
+ if (pkbuf->len < 2) {
1442
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
1443
+ return -1;
1444
+ }
1445
+
1446
+ source = (ogs_nas_extended_protocol_configuration_options_t *)pkbuf->data;
1447
1448
extended_protocol_configuration_options->length = be16toh(source->length);
1449
size = extended_protocol_configuration_options->length + sizeof(extended_protocol_configuration_options->length);
1450
1451
int ogs_nas_5gs_decode_mapped_eps_bearer_contexts(ogs_nas_mapped_eps_bearer_contexts_t *mapped_eps_bearer_contexts, ogs_pkbuf_t *pkbuf)
1452
{
1453
int size = 0;
1454
- ogs_nas_mapped_eps_bearer_contexts_t *source = (ogs_nas_mapped_eps_bearer_contexts_t *)pkbuf->data;
1455
+ ogs_nas_mapped_eps_bearer_contexts_t *source = NULL;
1456
+
1457
+ if (pkbuf->len < 2) {
1458
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
1459
+ return -1;
1460
+ }
1461
+
1462
+ source = (ogs_nas_mapped_eps_bearer_contexts_t *)pkbuf->data;
1463
1464
mapped_eps_bearer_contexts->length = be16toh(source->length);
1465
size = mapped_eps_bearer_contexts->length + sizeof(mapped_eps_bearer_contexts->length);
1466
open5gs_2.7.2.4565.531e.tar.xz/lib/nas/5gs/support/nas-message.py -> open5gs_2.7.2.4566.9251.tar.xz/lib/nas/5gs/support/nas-message.py
Changed
29
1
2
f.write("int ogs_nas_5gs_decode_%s(ogs_nas_%s_t *%s, ogs_pkbuf_t *pkbuf)\n" % (v_lower(k), v_lower(k), get_value(k)))
3
f.write("{\n")
4
f.write(" int size = 0;\n")
5
- f.write(" ogs_nas_%s_t *source = (ogs_nas_%s_t *)pkbuf->data;\n\n" % (v_lower(k), v_lower(k)))
6
+ f.write(" ogs_nas_%s_t *source = NULL;\n\n" % v_lower(k))
7
+ f.write(" if (pkbuf->len < 2) {\n")
8
+ f.write(" ogs_error(\"Not enough pkbuf len:%d\", pkbuf->len);\n")
9
+ f.write(" return -1;\n")
10
+ f.write(" }\n\n")
11
+ f.write(" source = (ogs_nas_%s_t *)pkbuf->data;\n\n" % v_lower(k))
12
f.write(" %s->length = be16toh(source->length);\n" % get_value(k))
13
f.write(" size = %s->length + sizeof(%s->length);\n\n" % (get_value(k), get_value(k)))
14
f.write(" if (ogs_pkbuf_pull(pkbuf, size) == NULL) {\n")
15
16
f.write("int ogs_nas_5gs_decode_%s(ogs_nas_%s_t *%s, ogs_pkbuf_t *pkbuf)\n" % (v_lower(k), v_lower(k), get_value(k)))
17
f.write("{\n")
18
f.write(" int size = 0;\n")
19
- f.write(" ogs_nas_%s_t *source = (ogs_nas_%s_t *)pkbuf->data;\n\n" % (v_lower(k), v_lower(k)))
20
+ f.write(" ogs_nas_%s_t *source = NULL;\n\n" % v_lower(k))
21
+ f.write(" if (pkbuf->len < 1) {\n")
22
+ f.write(" ogs_error(\"Not enough pkbuf len:%d\", pkbuf->len);\n")
23
+ f.write(" return -1;\n")
24
+ f.write(" }\n\n")
25
+ f.write(" source = (ogs_nas_%s_t *)pkbuf->data;\n\n" % v_lower(k))
26
f.write(" %s->length = source->length;\n" % get_value(k))
27
f.write(" size = %s->length + sizeof(%s->length);\n\n" % (get_value(k), get_value(k)))
28
f.write(" if (ogs_pkbuf_pull(pkbuf, size) == NULL) {\n")
29
open5gs_2.7.2.4565.531e.tar.xz/lib/nas/eps/ies.c -> open5gs_2.7.2.4566.9251.tar.xz/lib/nas/eps/ies.c
Changed
1034
1
2
/*******************************************************************************
3
* This file had been created by nas-message.py script v0.1.0
4
* Please do not modify this file but regenerate it via script.
5
- * Created on: 2024-01-21 18:50:03.402793 by acetcom
6
+ * Created on: 2024-12-11 21:08:02.462921 by acetcom
7
* from 24301-h90.docx
8
******************************************************************************/
9
10
11
int ogs_nas_eps_decode_additional_information(ogs_nas_additional_information_t *additional_information, ogs_pkbuf_t *pkbuf)
12
{
13
int size = 0;
14
- ogs_nas_additional_information_t *source = (ogs_nas_additional_information_t *)pkbuf->data;
15
+ ogs_nas_additional_information_t *source = NULL;
16
+
17
+ if (pkbuf->len < 1) {
18
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
19
+ return -1;
20
+ }
21
+
22
+ source = (ogs_nas_additional_information_t *)pkbuf->data;
23
24
additional_information->length = source->length;
25
size = additional_information->length + sizeof(additional_information->length);
26
27
int ogs_nas_eps_decode_eps_bearer_context_status(ogs_nas_eps_bearer_context_status_t *eps_bearer_context_status, ogs_pkbuf_t *pkbuf)
28
{
29
int size = 0;
30
- ogs_nas_eps_bearer_context_status_t *source = (ogs_nas_eps_bearer_context_status_t *)pkbuf->data;
31
+ ogs_nas_eps_bearer_context_status_t *source = NULL;
32
+
33
+ if (pkbuf->len < 1) {
34
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
35
+ return -1;
36
+ }
37
+
38
+ source = (ogs_nas_eps_bearer_context_status_t *)pkbuf->data;
39
40
eps_bearer_context_status->length = source->length;
41
size = eps_bearer_context_status->length + sizeof(eps_bearer_context_status->length);
42
43
int ogs_nas_eps_decode_supported_codec_list(ogs_nas_supported_codec_list_t *supported_codec_list, ogs_pkbuf_t *pkbuf)
44
{
45
int size = 0;
46
- ogs_nas_supported_codec_list_t *source = (ogs_nas_supported_codec_list_t *)pkbuf->data;
47
+ ogs_nas_supported_codec_list_t *source = NULL;
48
+
49
+ if (pkbuf->len < 1) {
50
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
51
+ return -1;
52
+ }
53
+
54
+ source = (ogs_nas_supported_codec_list_t *)pkbuf->data;
55
56
supported_codec_list->length = source->length;
57
size = supported_codec_list->length + sizeof(supported_codec_list->length);
58
59
int ogs_nas_eps_decode_mobile_identity(ogs_nas_mobile_identity_t *mobile_identity, ogs_pkbuf_t *pkbuf)
60
{
61
int size = 0;
62
- ogs_nas_mobile_identity_t *source = (ogs_nas_mobile_identity_t *)pkbuf->data;
63
+ ogs_nas_mobile_identity_t *source = NULL;
64
+
65
+ if (pkbuf->len < 1) {
66
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
67
+ return -1;
68
+ }
69
+
70
+ source = (ogs_nas_mobile_identity_t *)pkbuf->data;
71
72
mobile_identity->length = source->length;
73
size = mobile_identity->length + sizeof(mobile_identity->length);
74
75
int ogs_nas_eps_decode_mobile_station_classmark_2(ogs_nas_mobile_station_classmark_2_t *mobile_station_classmark_2, ogs_pkbuf_t *pkbuf)
76
{
77
int size = 0;
78
- ogs_nas_mobile_station_classmark_2_t *source = (ogs_nas_mobile_station_classmark_2_t *)pkbuf->data;
79
+ ogs_nas_mobile_station_classmark_2_t *source = NULL;
80
+
81
+ if (pkbuf->len < 1) {
82
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
83
+ return -1;
84
+ }
85
+
86
+ source = (ogs_nas_mobile_station_classmark_2_t *)pkbuf->data;
87
88
mobile_station_classmark_2->length = source->length;
89
size = mobile_station_classmark_2->length + sizeof(mobile_station_classmark_2->length);
90
91
int ogs_nas_eps_decode_mobile_station_classmark_3(ogs_nas_mobile_station_classmark_3_t *mobile_station_classmark_3, ogs_pkbuf_t *pkbuf)
92
{
93
int size = 0;
94
- ogs_nas_mobile_station_classmark_3_t *source = (ogs_nas_mobile_station_classmark_3_t *)pkbuf->data;
95
+ ogs_nas_mobile_station_classmark_3_t *source = NULL;
96
+
97
+ if (pkbuf->len < 1) {
98
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
99
+ return -1;
100
+ }
101
+
102
+ source = (ogs_nas_mobile_station_classmark_3_t *)pkbuf->data;
103
104
mobile_station_classmark_3->length = source->length;
105
size = mobile_station_classmark_3->length + sizeof(mobile_station_classmark_3->length);
106
107
int ogs_nas_eps_decode_plmn_list(ogs_nas_plmn_list_t *plmn_list, ogs_pkbuf_t *pkbuf)
108
{
109
int size = 0;
110
- ogs_nas_plmn_list_t *source = (ogs_nas_plmn_list_t *)pkbuf->data;
111
+ ogs_nas_plmn_list_t *source = NULL;
112
+
113
+ if (pkbuf->len < 1) {
114
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
115
+ return -1;
116
+ }
117
+
118
+ source = (ogs_nas_plmn_list_t *)pkbuf->data;
119
120
plmn_list->length = source->length;
121
size = plmn_list->length + sizeof(plmn_list->length);
122
123
int ogs_nas_eps_decode_authentication_failure_parameter(ogs_nas_authentication_failure_parameter_t *authentication_failure_parameter, ogs_pkbuf_t *pkbuf)
124
{
125
int size = 0;
126
- ogs_nas_authentication_failure_parameter_t *source = (ogs_nas_authentication_failure_parameter_t *)pkbuf->data;
127
+ ogs_nas_authentication_failure_parameter_t *source = NULL;
128
+
129
+ if (pkbuf->len < 1) {
130
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
131
+ return -1;
132
+ }
133
+
134
+ source = (ogs_nas_authentication_failure_parameter_t *)pkbuf->data;
135
136
authentication_failure_parameter->length = source->length;
137
size = authentication_failure_parameter->length + sizeof(authentication_failure_parameter->length);
138
139
int ogs_nas_eps_decode_eps_mobile_identity(ogs_nas_eps_mobile_identity_t *eps_mobile_identity, ogs_pkbuf_t *pkbuf)
140
{
141
int size = 0;
142
- ogs_nas_eps_mobile_identity_t *source = (ogs_nas_eps_mobile_identity_t *)pkbuf->data;
143
+ ogs_nas_eps_mobile_identity_t *source = NULL;
144
+
145
+ if (pkbuf->len < 1) {
146
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
147
+ return -1;
148
+ }
149
+
150
+ source = (ogs_nas_eps_mobile_identity_t *)pkbuf->data;
151
152
eps_mobile_identity->length = source->length;
153
size = eps_mobile_identity->length + sizeof(eps_mobile_identity->length);
154
155
int ogs_nas_eps_decode_eps_network_feature_support(ogs_nas_eps_network_feature_support_t *eps_network_feature_support, ogs_pkbuf_t *pkbuf)
156
{
157
int size = 0;
158
- ogs_nas_eps_network_feature_support_t *source = (ogs_nas_eps_network_feature_support_t *)pkbuf->data;
159
+ ogs_nas_eps_network_feature_support_t *source = NULL;
160
+
161
+ if (pkbuf->len < 1) {
162
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
163
+ return -1;
164
+ }
165
+
166
+ source = (ogs_nas_eps_network_feature_support_t *)pkbuf->data;
167
168
eps_network_feature_support->length = source->length;
169
size = eps_network_feature_support->length + sizeof(eps_network_feature_support->length);
170
171
int ogs_nas_eps_decode_esm_message_container(ogs_nas_esm_message_container_t *esm_message_container, ogs_pkbuf_t *pkbuf)
172
{
173
int size = 0;
174
- ogs_nas_esm_message_container_t *source = (ogs_nas_esm_message_container_t *)pkbuf->data;
175
+ ogs_nas_esm_message_container_t *source = NULL;
176
+
177
+ if (pkbuf->len < 2) {
178
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
179
+ return -1;
180
+ }
181
+
182
+ source = (ogs_nas_esm_message_container_t *)pkbuf->data;
183
184
esm_message_container->length = be16toh(source->length);
185
size = esm_message_container->length + sizeof(esm_message_container->length);
186
187
int ogs_nas_eps_decode_gprs_timer_2(ogs_nas_gprs_timer_2_t *gprs_timer_2, ogs_pkbuf_t *pkbuf)
188
{
189
int size = 0;
190
- ogs_nas_gprs_timer_2_t *source = (ogs_nas_gprs_timer_2_t *)pkbuf->data;
191
+ ogs_nas_gprs_timer_2_t *source = NULL;
192
+
193
+ if (pkbuf->len < 1) {
194
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
195
+ return -1;
196
+ }
197
+
198
+ source = (ogs_nas_gprs_timer_2_t *)pkbuf->data;
199
200
gprs_timer_2->length = source->length;
201
size = gprs_timer_2->length + sizeof(gprs_timer_2->length);
202
203
int ogs_nas_eps_decode_gprs_timer_3(ogs_nas_gprs_timer_3_t *gprs_timer_3, ogs_pkbuf_t *pkbuf)
204
{
205
int size = 0;
206
- ogs_nas_gprs_timer_3_t *source = (ogs_nas_gprs_timer_3_t *)pkbuf->data;
207
+ ogs_nas_gprs_timer_3_t *source = NULL;
208
+
209
+ if (pkbuf->len < 1) {
210
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
211
+ return -1;
212
+ }
213
+
214
+ source = (ogs_nas_gprs_timer_3_t *)pkbuf->data;
215
216
gprs_timer_3->length = source->length;
217
size = gprs_timer_3->length + sizeof(gprs_timer_3->length);
218
219
int ogs_nas_eps_decode_authentication_parameter_autn(ogs_nas_authentication_parameter_autn_t *authentication_parameter_autn, ogs_pkbuf_t *pkbuf)
220
{
221
int size = 0;
222
- ogs_nas_authentication_parameter_autn_t *source = (ogs_nas_authentication_parameter_autn_t *)pkbuf->data;
223
+ ogs_nas_authentication_parameter_autn_t *source = NULL;
224
+
225
+ if (pkbuf->len < 1) {
226
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
227
+ return -1;
228
+ }
229
+
230
+ source = (ogs_nas_authentication_parameter_autn_t *)pkbuf->data;
231
232
authentication_parameter_autn->length = source->length;
233
size = authentication_parameter_autn->length + sizeof(authentication_parameter_autn->length);
234
235
int ogs_nas_eps_decode_ms_network_capability(ogs_nas_ms_network_capability_t *ms_network_capability, ogs_pkbuf_t *pkbuf)
236
{
237
int size = 0;
238
- ogs_nas_ms_network_capability_t *source = (ogs_nas_ms_network_capability_t *)pkbuf->data;
239
+ ogs_nas_ms_network_capability_t *source = NULL;
240
+
241
+ if (pkbuf->len < 1) {
242
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
243
+ return -1;
244
+ }
245
+
246
+ source = (ogs_nas_ms_network_capability_t *)pkbuf->data;
247
248
ms_network_capability->length = source->length;
249
size = ms_network_capability->length + sizeof(ms_network_capability->length);
250
251
int ogs_nas_eps_decode_eps_message_container(ogs_nas_eps_message_container_t *eps_message_container, ogs_pkbuf_t *pkbuf)
252
{
253
int size = 0;
254
- ogs_nas_eps_message_container_t *source = (ogs_nas_eps_message_container_t *)pkbuf->data;
255
+ ogs_nas_eps_message_container_t *source = NULL;
256
+
257
+ if (pkbuf->len < 1) {
258
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
259
+ return -1;
260
+ }
261
+
262
+ source = (ogs_nas_eps_message_container_t *)pkbuf->data;
263
264
eps_message_container->length = source->length;
265
size = eps_message_container->length + sizeof(eps_message_container->length);
266
267
int ogs_nas_eps_decode_network_name(ogs_nas_network_name_t *network_name, ogs_pkbuf_t *pkbuf)
268
{
269
int size = 0;
270
- ogs_nas_network_name_t *source = (ogs_nas_network_name_t *)pkbuf->data;
271
+ ogs_nas_network_name_t *source = NULL;
272
+
273
+ if (pkbuf->len < 1) {
274
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
275
+ return -1;
276
+ }
277
+
278
+ source = (ogs_nas_network_name_t *)pkbuf->data;
279
280
network_name->length = source->length;
281
size = network_name->length + sizeof(network_name->length);
282
283
int ogs_nas_eps_decode_network_resource_identifier_container(ogs_nas_network_resource_identifier_container_t *network_resource_identifier_container, ogs_pkbuf_t *pkbuf)
284
{
285
int size = 0;
286
- ogs_nas_network_resource_identifier_container_t *source = (ogs_nas_network_resource_identifier_container_t *)pkbuf->data;
287
+ ogs_nas_network_resource_identifier_container_t *source = NULL;
288
+
289
+ if (pkbuf->len < 1) {
290
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
291
+ return -1;
292
+ }
293
+
294
+ source = (ogs_nas_network_resource_identifier_container_t *)pkbuf->data;
295
296
network_resource_identifier_container->length = source->length;
297
size = network_resource_identifier_container->length + sizeof(network_resource_identifier_container->length);
298
299
int ogs_nas_eps_decode_tracking_area_identity_list(ogs_nas_tracking_area_identity_list_t *tracking_area_identity_list, ogs_pkbuf_t *pkbuf)
300
{
301
int size = 0;
302
- ogs_nas_tracking_area_identity_list_t *source = (ogs_nas_tracking_area_identity_list_t *)pkbuf->data;
303
+ ogs_nas_tracking_area_identity_list_t *source = NULL;
304
+
305
+ if (pkbuf->len < 1) {
306
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
307
+ return -1;
308
+ }
309
+
310
+ source = (ogs_nas_tracking_area_identity_list_t *)pkbuf->data;
311
312
tracking_area_identity_list->length = source->length;
313
size = tracking_area_identity_list->length + sizeof(tracking_area_identity_list->length);
314
315
int ogs_nas_eps_decode_ue_network_capability(ogs_nas_ue_network_capability_t *ue_network_capability, ogs_pkbuf_t *pkbuf)
316
{
317
int size = 0;
318
- ogs_nas_ue_network_capability_t *source = (ogs_nas_ue_network_capability_t *)pkbuf->data;
319
+ ogs_nas_ue_network_capability_t *source = NULL;
320
+
321
+ if (pkbuf->len < 1) {
322
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
323
+ return -1;
324
+ }
325
+
326
+ source = (ogs_nas_ue_network_capability_t *)pkbuf->data;
327
328
ue_network_capability->length = source->length;
329
size = ue_network_capability->length + sizeof(ue_network_capability->length);
330
331
int ogs_nas_eps_decode_ue_security_capability(ogs_nas_ue_security_capability_t *ue_security_capability, ogs_pkbuf_t *pkbuf)
332
{
333
int size = 0;
334
- ogs_nas_ue_security_capability_t *source = (ogs_nas_ue_security_capability_t *)pkbuf->data;
335
+ ogs_nas_ue_security_capability_t *source = NULL;
336
+
337
+ if (pkbuf->len < 1) {
338
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
339
+ return -1;
340
+ }
341
+
342
+ source = (ogs_nas_ue_security_capability_t *)pkbuf->data;
343
344
ue_security_capability->length = source->length;
345
size = ue_security_capability->length + sizeof(ue_security_capability->length);
346
347
int ogs_nas_eps_decode_emergency_number_list(ogs_nas_emergency_number_list_t *emergency_number_list, ogs_pkbuf_t *pkbuf)
348
{
349
int size = 0;
350
- ogs_nas_emergency_number_list_t *source = (ogs_nas_emergency_number_list_t *)pkbuf->data;
351
+ ogs_nas_emergency_number_list_t *source = NULL;
352
+
353
+ if (pkbuf->len < 1) {
354
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
355
+ return -1;
356
+ }
357
+
358
+ source = (ogs_nas_emergency_number_list_t *)pkbuf->data;
359
360
emergency_number_list->length = source->length;
361
size = emergency_number_list->length + sizeof(emergency_number_list->length);
362
363
int ogs_nas_eps_decode_extended_emergency_number_list(ogs_nas_extended_emergency_number_list_t *extended_emergency_number_list, ogs_pkbuf_t *pkbuf)
364
{
365
int size = 0;
366
- ogs_nas_extended_emergency_number_list_t *source = (ogs_nas_extended_emergency_number_list_t *)pkbuf->data;
367
+ ogs_nas_extended_emergency_number_list_t *source = NULL;
368
+
369
+ if (pkbuf->len < 2) {
370
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
371
+ return -1;
372
+ }
373
+
374
+ source = (ogs_nas_extended_emergency_number_list_t *)pkbuf->data;
375
376
extended_emergency_number_list->length = be16toh(source->length);
377
size = extended_emergency_number_list->length + sizeof(extended_emergency_number_list->length);
378
379
int ogs_nas_eps_decode_cli(ogs_nas_cli_t *cli, ogs_pkbuf_t *pkbuf)
380
{
381
int size = 0;
382
- ogs_nas_cli_t *source = (ogs_nas_cli_t *)pkbuf->data;
383
+ ogs_nas_cli_t *source = NULL;
384
+
385
+ if (pkbuf->len < 1) {
386
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
387
+ return -1;
388
+ }
389
+
390
+ source = (ogs_nas_cli_t *)pkbuf->data;
391
392
cli->length = source->length;
393
size = cli->length + sizeof(cli->length);
394
395
int ogs_nas_eps_decode_authentication_response_parameter(ogs_nas_authentication_response_parameter_t *authentication_response_parameter, ogs_pkbuf_t *pkbuf)
396
{
397
int size = 0;
398
- ogs_nas_authentication_response_parameter_t *source = (ogs_nas_authentication_response_parameter_t *)pkbuf->data;
399
+ ogs_nas_authentication_response_parameter_t *source = NULL;
400
+
401
+ if (pkbuf->len < 1) {
402
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
403
+ return -1;
404
+ }
405
+
406
+ source = (ogs_nas_authentication_response_parameter_t *)pkbuf->data;
407
408
authentication_response_parameter->length = source->length;
409
size = authentication_response_parameter->length + sizeof(authentication_response_parameter->length);
410
411
int ogs_nas_eps_decode_lcs_client_identity(ogs_nas_lcs_client_identity_t *lcs_client_identity, ogs_pkbuf_t *pkbuf)
412
{
413
int size = 0;
414
- ogs_nas_lcs_client_identity_t *source = (ogs_nas_lcs_client_identity_t *)pkbuf->data;
415
+ ogs_nas_lcs_client_identity_t *source = NULL;
416
+
417
+ if (pkbuf->len < 1) {
418
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
419
+ return -1;
420
+ }
421
+
422
+ source = (ogs_nas_lcs_client_identity_t *)pkbuf->data;
423
424
lcs_client_identity->length = source->length;
425
size = lcs_client_identity->length + sizeof(lcs_client_identity->length);
426
427
int ogs_nas_eps_decode_generic_message_container(ogs_nas_generic_message_container_t *generic_message_container, ogs_pkbuf_t *pkbuf)
428
{
429
int size = 0;
430
- ogs_nas_generic_message_container_t *source = (ogs_nas_generic_message_container_t *)pkbuf->data;
431
+ ogs_nas_generic_message_container_t *source = NULL;
432
+
433
+ if (pkbuf->len < 2) {
434
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
435
+ return -1;
436
+ }
437
+
438
+ source = (ogs_nas_generic_message_container_t *)pkbuf->data;
439
440
generic_message_container->length = be16toh(source->length);
441
size = generic_message_container->length + sizeof(generic_message_container->length);
442
443
int ogs_nas_eps_decode_voice_domain_preference_and_ue_usage_setting(ogs_nas_voice_domain_preference_and_ue_usage_setting_t *voice_domain_preference_and_ue_usage_setting, ogs_pkbuf_t *pkbuf)
444
{
445
int size = 0;
446
- ogs_nas_voice_domain_preference_and_ue_usage_setting_t *source = (ogs_nas_voice_domain_preference_and_ue_usage_setting_t *)pkbuf->data;
447
+ ogs_nas_voice_domain_preference_and_ue_usage_setting_t *source = NULL;
448
+
449
+ if (pkbuf->len < 1) {
450
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
451
+ return -1;
452
+ }
453
+
454
+ source = (ogs_nas_voice_domain_preference_and_ue_usage_setting_t *)pkbuf->data;
455
456
voice_domain_preference_and_ue_usage_setting->length = source->length;
457
size = voice_domain_preference_and_ue_usage_setting->length + sizeof(voice_domain_preference_and_ue_usage_setting->length);
458
459
int ogs_nas_eps_decode_extended_drx_parameters(ogs_nas_extended_drx_parameters_t *extended_drx_parameters, ogs_pkbuf_t *pkbuf)
460
{
461
int size = 0;
462
- ogs_nas_extended_drx_parameters_t *source = (ogs_nas_extended_drx_parameters_t *)pkbuf->data;
463
+ ogs_nas_extended_drx_parameters_t *source = NULL;
464
+
465
+ if (pkbuf->len < 1) {
466
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
467
+ return -1;
468
+ }
469
+
470
+ source = (ogs_nas_extended_drx_parameters_t *)pkbuf->data;
471
472
extended_drx_parameters->length = source->length;
473
size = extended_drx_parameters->length + sizeof(extended_drx_parameters->length);
474
475
int ogs_nas_eps_decode_dcn_id(ogs_nas_dcn_id_t *dcn_id, ogs_pkbuf_t *pkbuf)
476
{
477
int size = 0;
478
- ogs_nas_dcn_id_t *source = (ogs_nas_dcn_id_t *)pkbuf->data;
479
+ ogs_nas_dcn_id_t *source = NULL;
480
+
481
+ if (pkbuf->len < 1) {
482
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
483
+ return -1;
484
+ }
485
+
486
+ source = (ogs_nas_dcn_id_t *)pkbuf->data;
487
488
dcn_id->length = source->length;
489
size = dcn_id->length + sizeof(dcn_id->length);
490
491
int ogs_nas_eps_decode_hashmme(ogs_nas_hashmme_t *hashmme, ogs_pkbuf_t *pkbuf)
492
{
493
int size = 0;
494
- ogs_nas_hashmme_t *source = (ogs_nas_hashmme_t *)pkbuf->data;
495
+ ogs_nas_hashmme_t *source = NULL;
496
+
497
+ if (pkbuf->len < 1) {
498
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
499
+ return -1;
500
+ }
501
+
502
+ source = (ogs_nas_hashmme_t *)pkbuf->data;
503
504
hashmme->length = source->length;
505
size = hashmme->length + sizeof(hashmme->length);
506
507
int ogs_nas_eps_decode_replayed_nas_message_container(ogs_nas_replayed_nas_message_container_t *replayed_nas_message_container, ogs_pkbuf_t *pkbuf)
508
{
509
int size = 0;
510
- ogs_nas_replayed_nas_message_container_t *source = (ogs_nas_replayed_nas_message_container_t *)pkbuf->data;
511
+ ogs_nas_replayed_nas_message_container_t *source = NULL;
512
+
513
+ if (pkbuf->len < 2) {
514
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
515
+ return -1;
516
+ }
517
+
518
+ source = (ogs_nas_replayed_nas_message_container_t *)pkbuf->data;
519
520
replayed_nas_message_container->length = be16toh(source->length);
521
size = replayed_nas_message_container->length + sizeof(replayed_nas_message_container->length);
522
523
int ogs_nas_eps_decode_ue_additional_security_capability(ogs_nas_ue_additional_security_capability_t *ue_additional_security_capability, ogs_pkbuf_t *pkbuf)
524
{
525
int size = 0;
526
- ogs_nas_ue_additional_security_capability_t *source = (ogs_nas_ue_additional_security_capability_t *)pkbuf->data;
527
+ ogs_nas_ue_additional_security_capability_t *source = NULL;
528
+
529
+ if (pkbuf->len < 1) {
530
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
531
+ return -1;
532
+ }
533
+
534
+ source = (ogs_nas_ue_additional_security_capability_t *)pkbuf->data;
535
536
ue_additional_security_capability->length = source->length;
537
size = ue_additional_security_capability->length + sizeof(ue_additional_security_capability->length);
538
539
int ogs_nas_eps_decode_ue_status(ogs_nas_ue_status_t *ue_status, ogs_pkbuf_t *pkbuf)
540
{
541
int size = 0;
542
- ogs_nas_ue_status_t *source = (ogs_nas_ue_status_t *)pkbuf->data;
543
+ ogs_nas_ue_status_t *source = NULL;
544
+
545
+ if (pkbuf->len < 1) {
546
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
547
+ return -1;
548
+ }
549
+
550
+ source = (ogs_nas_ue_status_t *)pkbuf->data;
551
552
ue_status->length = source->length;
553
size = ue_status->length + sizeof(ue_status->length);
554
555
int ogs_nas_eps_decode_ciphering_key_data(ogs_nas_ciphering_key_data_t *ciphering_key_data, ogs_pkbuf_t *pkbuf)
556
{
557
int size = 0;
558
- ogs_nas_ciphering_key_data_t *source = (ogs_nas_ciphering_key_data_t *)pkbuf->data;
559
+ ogs_nas_ciphering_key_data_t *source = NULL;
560
+
561
+ if (pkbuf->len < 2) {
562
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
563
+ return -1;
564
+ }
565
+
566
+ source = (ogs_nas_ciphering_key_data_t *)pkbuf->data;
567
568
ciphering_key_data->length = be16toh(source->length);
569
size = ciphering_key_data->length + sizeof(ciphering_key_data->length);
570
571
int ogs_nas_eps_decode_n1_ue_network_capability(ogs_nas_n1_ue_network_capability_t *n1_ue_network_capability, ogs_pkbuf_t *pkbuf)
572
{
573
int size = 0;
574
- ogs_nas_n1_ue_network_capability_t *source = (ogs_nas_n1_ue_network_capability_t *)pkbuf->data;
575
+ ogs_nas_n1_ue_network_capability_t *source = NULL;
576
+
577
+ if (pkbuf->len < 1) {
578
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
579
+ return -1;
580
+ }
581
+
582
+ source = (ogs_nas_n1_ue_network_capability_t *)pkbuf->data;
583
584
n1_ue_network_capability->length = source->length;
585
size = n1_ue_network_capability->length + sizeof(n1_ue_network_capability->length);
586
587
int ogs_nas_eps_decode_ue_radio_capability_id_availability(ogs_nas_ue_radio_capability_id_availability_t *ue_radio_capability_id_availability, ogs_pkbuf_t *pkbuf)
588
{
589
int size = 0;
590
- ogs_nas_ue_radio_capability_id_availability_t *source = (ogs_nas_ue_radio_capability_id_availability_t *)pkbuf->data;
591
+ ogs_nas_ue_radio_capability_id_availability_t *source = NULL;
592
+
593
+ if (pkbuf->len < 1) {
594
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
595
+ return -1;
596
+ }
597
+
598
+ source = (ogs_nas_ue_radio_capability_id_availability_t *)pkbuf->data;
599
600
ue_radio_capability_id_availability->length = source->length;
601
size = ue_radio_capability_id_availability->length + sizeof(ue_radio_capability_id_availability->length);
602
603
int ogs_nas_eps_decode_ue_radio_capability_id_request(ogs_nas_ue_radio_capability_id_request_t *ue_radio_capability_id_request, ogs_pkbuf_t *pkbuf)
604
{
605
int size = 0;
606
- ogs_nas_ue_radio_capability_id_request_t *source = (ogs_nas_ue_radio_capability_id_request_t *)pkbuf->data;
607
+ ogs_nas_ue_radio_capability_id_request_t *source = NULL;
608
+
609
+ if (pkbuf->len < 1) {
610
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
611
+ return -1;
612
+ }
613
+
614
+ source = (ogs_nas_ue_radio_capability_id_request_t *)pkbuf->data;
615
616
ue_radio_capability_id_request->length = source->length;
617
size = ue_radio_capability_id_request->length + sizeof(ue_radio_capability_id_request->length);
618
619
int ogs_nas_eps_decode_daylight_saving_time(ogs_nas_daylight_saving_time_t *daylight_saving_time, ogs_pkbuf_t *pkbuf)
620
{
621
int size = 0;
622
- ogs_nas_daylight_saving_time_t *source = (ogs_nas_daylight_saving_time_t *)pkbuf->data;
623
+ ogs_nas_daylight_saving_time_t *source = NULL;
624
+
625
+ if (pkbuf->len < 1) {
626
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
627
+ return -1;
628
+ }
629
+
630
+ source = (ogs_nas_daylight_saving_time_t *)pkbuf->data;
631
632
daylight_saving_time->length = source->length;
633
size = daylight_saving_time->length + sizeof(daylight_saving_time->length);
634
635
int ogs_nas_eps_decode_ue_radio_capability_id(ogs_nas_ue_radio_capability_id_t *ue_radio_capability_id, ogs_pkbuf_t *pkbuf)
636
{
637
int size = 0;
638
- ogs_nas_ue_radio_capability_id_t *source = (ogs_nas_ue_radio_capability_id_t *)pkbuf->data;
639
+ ogs_nas_ue_radio_capability_id_t *source = NULL;
640
+
641
+ if (pkbuf->len < 1) {
642
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
643
+ return -1;
644
+ }
645
+
646
+ source = (ogs_nas_ue_radio_capability_id_t *)pkbuf->data;
647
648
ue_radio_capability_id->length = source->length;
649
size = ue_radio_capability_id->length + sizeof(ue_radio_capability_id->length);
650
651
int ogs_nas_eps_decode_wus_assistance_information(ogs_nas_wus_assistance_information_t *wus_assistance_information, ogs_pkbuf_t *pkbuf)
652
{
653
int size = 0;
654
- ogs_nas_wus_assistance_information_t *source = (ogs_nas_wus_assistance_information_t *)pkbuf->data;
655
+ ogs_nas_wus_assistance_information_t *source = NULL;
656
+
657
+ if (pkbuf->len < 1) {
658
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
659
+ return -1;
660
+ }
661
+
662
+ source = (ogs_nas_wus_assistance_information_t *)pkbuf->data;
663
664
wus_assistance_information->length = source->length;
665
size = wus_assistance_information->length + sizeof(wus_assistance_information->length);
666
667
int ogs_nas_eps_decode_nb_s1_drx_parameter(ogs_nas_nb_s1_drx_parameter_t *nb_s1_drx_parameter, ogs_pkbuf_t *pkbuf)
668
{
669
int size = 0;
670
- ogs_nas_nb_s1_drx_parameter_t *source = (ogs_nas_nb_s1_drx_parameter_t *)pkbuf->data;
671
+ ogs_nas_nb_s1_drx_parameter_t *source = NULL;
672
+
673
+ if (pkbuf->len < 1) {
674
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
675
+ return -1;
676
+ }
677
+
678
+ source = (ogs_nas_nb_s1_drx_parameter_t *)pkbuf->data;
679
680
nb_s1_drx_parameter->length = source->length;
681
size = nb_s1_drx_parameter->length + sizeof(nb_s1_drx_parameter->length);
682
683
int ogs_nas_eps_decode_imsi_offset(ogs_nas_imsi_offset_t *imsi_offset, ogs_pkbuf_t *pkbuf)
684
{
685
int size = 0;
686
- ogs_nas_imsi_offset_t *source = (ogs_nas_imsi_offset_t *)pkbuf->data;
687
+ ogs_nas_imsi_offset_t *source = NULL;
688
+
689
+ if (pkbuf->len < 1) {
690
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
691
+ return -1;
692
+ }
693
+
694
+ source = (ogs_nas_imsi_offset_t *)pkbuf->data;
695
696
imsi_offset->length = source->length;
697
size = imsi_offset->length + sizeof(imsi_offset->length);
698
699
int ogs_nas_eps_decode_ue_request_type(ogs_nas_ue_request_type_t *ue_request_type, ogs_pkbuf_t *pkbuf)
700
{
701
int size = 0;
702
- ogs_nas_ue_request_type_t *source = (ogs_nas_ue_request_type_t *)pkbuf->data;
703
+ ogs_nas_ue_request_type_t *source = NULL;
704
+
705
+ if (pkbuf->len < 1) {
706
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
707
+ return -1;
708
+ }
709
+
710
+ source = (ogs_nas_ue_request_type_t *)pkbuf->data;
711
712
ue_request_type->length = source->length;
713
size = ue_request_type->length + sizeof(ue_request_type->length);
714
715
int ogs_nas_eps_decode_paging_restriction(ogs_nas_paging_restriction_t *paging_restriction, ogs_pkbuf_t *pkbuf)
716
{
717
int size = 0;
718
- ogs_nas_paging_restriction_t *source = (ogs_nas_paging_restriction_t *)pkbuf->data;
719
+ ogs_nas_paging_restriction_t *source = NULL;
720
+
721
+ if (pkbuf->len < 1) {
722
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
723
+ return -1;
724
+ }
725
+
726
+ source = (ogs_nas_paging_restriction_t *)pkbuf->data;
727
728
paging_restriction->length = source->length;
729
size = paging_restriction->length + sizeof(paging_restriction->length);
730
731
int ogs_nas_eps_decode_eps_additional_request_result(ogs_nas_eps_additional_request_result_t *eps_additional_request_result, ogs_pkbuf_t *pkbuf)
732
{
733
int size = 0;
734
- ogs_nas_eps_additional_request_result_t *source = (ogs_nas_eps_additional_request_result_t *)pkbuf->data;
735
+ ogs_nas_eps_additional_request_result_t *source = NULL;
736
+
737
+ if (pkbuf->len < 1) {
738
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
739
+ return -1;
740
+ }
741
+
742
+ source = (ogs_nas_eps_additional_request_result_t *)pkbuf->data;
743
744
eps_additional_request_result->length = source->length;
745
size = eps_additional_request_result->length + sizeof(eps_additional_request_result->length);
746
747
int ogs_nas_eps_decode_access_point_name(ogs_nas_access_point_name_t *access_point_name, ogs_pkbuf_t *pkbuf)
748
{
749
int size = 0;
750
- ogs_nas_access_point_name_t *source = (ogs_nas_access_point_name_t *)pkbuf->data;
751
+ ogs_nas_access_point_name_t *source = NULL;
752
+
753
+ if (pkbuf->len < 1) {
754
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
755
+ return -1;
756
+ }
757
+
758
+ source = (ogs_nas_access_point_name_t *)pkbuf->data;
759
760
access_point_name->length = source->length;
761
size = access_point_name->length + sizeof(access_point_name->length);
762
763
int ogs_nas_eps_decode_protocol_configuration_options(ogs_nas_protocol_configuration_options_t *protocol_configuration_options, ogs_pkbuf_t *pkbuf)
764
{
765
int size = 0;
766
- ogs_nas_protocol_configuration_options_t *source = (ogs_nas_protocol_configuration_options_t *)pkbuf->data;
767
+ ogs_nas_protocol_configuration_options_t *source = NULL;
768
+
769
+ if (pkbuf->len < 1) {
770
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
771
+ return -1;
772
+ }
773
+
774
+ source = (ogs_nas_protocol_configuration_options_t *)pkbuf->data;
775
776
protocol_configuration_options->length = source->length;
777
size = protocol_configuration_options->length + sizeof(protocol_configuration_options->length);
778
779
int ogs_nas_eps_decode_quality_of_service(ogs_nas_quality_of_service_t *quality_of_service, ogs_pkbuf_t *pkbuf)
780
{
781
int size = 0;
782
- ogs_nas_quality_of_service_t *source = (ogs_nas_quality_of_service_t *)pkbuf->data;
783
+ ogs_nas_quality_of_service_t *source = NULL;
784
+
785
+ if (pkbuf->len < 1) {
786
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
787
+ return -1;
788
+ }
789
+
790
+ source = (ogs_nas_quality_of_service_t *)pkbuf->data;
791
792
quality_of_service->length = source->length;
793
size = quality_of_service->length + sizeof(quality_of_service->length);
794
795
int ogs_nas_eps_decode_re_attempt_indicator(ogs_nas_re_attempt_indicator_t *re_attempt_indicator, ogs_pkbuf_t *pkbuf)
796
{
797
int size = 0;
798
- ogs_nas_re_attempt_indicator_t *source = (ogs_nas_re_attempt_indicator_t *)pkbuf->data;
799
+ ogs_nas_re_attempt_indicator_t *source = NULL;
800
+
801
+ if (pkbuf->len < 1) {
802
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
803
+ return -1;
804
+ }
805
+
806
+ source = (ogs_nas_re_attempt_indicator_t *)pkbuf->data;
807
808
re_attempt_indicator->length = source->length;
809
size = re_attempt_indicator->length + sizeof(re_attempt_indicator->length);
810
811
int ogs_nas_eps_decode_traffic_flow_aggregate_description(ogs_nas_traffic_flow_aggregate_description_t *traffic_flow_aggregate_description, ogs_pkbuf_t *pkbuf)
812
{
813
int size = 0;
814
- ogs_nas_traffic_flow_aggregate_description_t *source = (ogs_nas_traffic_flow_aggregate_description_t *)pkbuf->data;
815
+ ogs_nas_traffic_flow_aggregate_description_t *source = NULL;
816
+
817
+ if (pkbuf->len < 1) {
818
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
819
+ return -1;
820
+ }
821
+
822
+ source = (ogs_nas_traffic_flow_aggregate_description_t *)pkbuf->data;
823
824
traffic_flow_aggregate_description->length = source->length;
825
size = traffic_flow_aggregate_description->length + sizeof(traffic_flow_aggregate_description->length);
826
827
int ogs_nas_eps_decode_traffic_flow_template(ogs_nas_traffic_flow_template_t *traffic_flow_template, ogs_pkbuf_t *pkbuf)
828
{
829
int size = 0;
830
- ogs_nas_traffic_flow_template_t *source = (ogs_nas_traffic_flow_template_t *)pkbuf->data;
831
+ ogs_nas_traffic_flow_template_t *source = NULL;
832
+
833
+ if (pkbuf->len < 1) {
834
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
835
+ return -1;
836
+ }
837
+
838
+ source = (ogs_nas_traffic_flow_template_t *)pkbuf->data;
839
840
traffic_flow_template->length = source->length;
841
size = traffic_flow_template->length + sizeof(traffic_flow_template->length);
842
843
int ogs_nas_eps_decode_transaction_identifier(ogs_nas_transaction_identifier_t *transaction_identifier, ogs_pkbuf_t *pkbuf)
844
{
845
int size = 0;
846
- ogs_nas_transaction_identifier_t *source = (ogs_nas_transaction_identifier_t *)pkbuf->data;
847
+ ogs_nas_transaction_identifier_t *source = NULL;
848
+
849
+ if (pkbuf->len < 1) {
850
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
851
+ return -1;
852
+ }
853
+
854
+ source = (ogs_nas_transaction_identifier_t *)pkbuf->data;
855
856
transaction_identifier->length = source->length;
857
size = transaction_identifier->length + sizeof(transaction_identifier->length);
858
859
int ogs_nas_eps_decode_nbifom_container(ogs_nas_nbifom_container_t *nbifom_container, ogs_pkbuf_t *pkbuf)
860
{
861
int size = 0;
862
- ogs_nas_nbifom_container_t *source = (ogs_nas_nbifom_container_t *)pkbuf->data;
863
+ ogs_nas_nbifom_container_t *source = NULL;
864
+
865
+ if (pkbuf->len < 1) {
866
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
867
+ return -1;
868
+ }
869
+
870
+ source = (ogs_nas_nbifom_container_t *)pkbuf->data;
871
872
nbifom_container->length = source->length;
873
size = nbifom_container->length + sizeof(nbifom_container->length);
874
875
int ogs_nas_eps_decode_apn_aggregate_maximum_bit_rate(ogs_nas_apn_aggregate_maximum_bit_rate_t *apn_aggregate_maximum_bit_rate, ogs_pkbuf_t *pkbuf)
876
{
877
int size = 0;
878
- ogs_nas_apn_aggregate_maximum_bit_rate_t *source = (ogs_nas_apn_aggregate_maximum_bit_rate_t *)pkbuf->data;
879
+ ogs_nas_apn_aggregate_maximum_bit_rate_t *source = NULL;
880
+
881
+ if (pkbuf->len < 1) {
882
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
883
+ return -1;
884
+ }
885
+
886
+ source = (ogs_nas_apn_aggregate_maximum_bit_rate_t *)pkbuf->data;
887
888
apn_aggregate_maximum_bit_rate->length = source->length;
889
size = apn_aggregate_maximum_bit_rate->length + sizeof(apn_aggregate_maximum_bit_rate->length);
890
891
int ogs_nas_eps_decode_header_compression_configuration(ogs_nas_header_compression_configuration_t *header_compression_configuration, ogs_pkbuf_t *pkbuf)
892
{
893
int size = 0;
894
- ogs_nas_header_compression_configuration_t *source = (ogs_nas_header_compression_configuration_t *)pkbuf->data;
895
+ ogs_nas_header_compression_configuration_t *source = NULL;
896
+
897
+ if (pkbuf->len < 1) {
898
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
899
+ return -1;
900
+ }
901
+
902
+ source = (ogs_nas_header_compression_configuration_t *)pkbuf->data;
903
904
header_compression_configuration->length = source->length;
905
size = header_compression_configuration->length + sizeof(header_compression_configuration->length);
906
907
int ogs_nas_eps_decode_extended_protocol_configuration_options(ogs_nas_extended_protocol_configuration_options_t *extended_protocol_configuration_options, ogs_pkbuf_t *pkbuf)
908
{
909
int size = 0;
910
- ogs_nas_extended_protocol_configuration_options_t *source = (ogs_nas_extended_protocol_configuration_options_t *)pkbuf->data;
911
+ ogs_nas_extended_protocol_configuration_options_t *source = NULL;
912
+
913
+ if (pkbuf->len < 2) {
914
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
915
+ return -1;
916
+ }
917
+
918
+ source = (ogs_nas_extended_protocol_configuration_options_t *)pkbuf->data;
919
920
extended_protocol_configuration_options->length = be16toh(source->length);
921
size = extended_protocol_configuration_options->length + sizeof(extended_protocol_configuration_options->length);
922
923
int ogs_nas_eps_decode_header_compression_configuration_status(ogs_nas_header_compression_configuration_status_t *header_compression_configuration_status, ogs_pkbuf_t *pkbuf)
924
{
925
int size = 0;
926
- ogs_nas_header_compression_configuration_status_t *source = (ogs_nas_header_compression_configuration_status_t *)pkbuf->data;
927
+ ogs_nas_header_compression_configuration_status_t *source = NULL;
928
+
929
+ if (pkbuf->len < 1) {
930
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
931
+ return -1;
932
+ }
933
+
934
+ source = (ogs_nas_header_compression_configuration_status_t *)pkbuf->data;
935
936
header_compression_configuration_status->length = source->length;
937
size = header_compression_configuration_status->length + sizeof(header_compression_configuration_status->length);
938
939
int ogs_nas_eps_decode_serving_plmn_rate_control(ogs_nas_serving_plmn_rate_control_t *serving_plmn_rate_control, ogs_pkbuf_t *pkbuf)
940
{
941
int size = 0;
942
- ogs_nas_serving_plmn_rate_control_t *source = (ogs_nas_serving_plmn_rate_control_t *)pkbuf->data;
943
+ ogs_nas_serving_plmn_rate_control_t *source = NULL;
944
+
945
+ if (pkbuf->len < 1) {
946
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
947
+ return -1;
948
+ }
949
+
950
+ source = (ogs_nas_serving_plmn_rate_control_t *)pkbuf->data;
951
952
serving_plmn_rate_control->length = source->length;
953
size = serving_plmn_rate_control->length + sizeof(serving_plmn_rate_control->length);
954
955
int ogs_nas_eps_decode_extended_apn_aggregate_maximum_bit_rate(ogs_nas_extended_apn_aggregate_maximum_bit_rate_t *extended_apn_aggregate_maximum_bit_rate, ogs_pkbuf_t *pkbuf)
956
{
957
int size = 0;
958
- ogs_nas_extended_apn_aggregate_maximum_bit_rate_t *source = (ogs_nas_extended_apn_aggregate_maximum_bit_rate_t *)pkbuf->data;
959
+ ogs_nas_extended_apn_aggregate_maximum_bit_rate_t *source = NULL;
960
+
961
+ if (pkbuf->len < 1) {
962
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
963
+ return -1;
964
+ }
965
+
966
+ source = (ogs_nas_extended_apn_aggregate_maximum_bit_rate_t *)pkbuf->data;
967
968
extended_apn_aggregate_maximum_bit_rate->length = source->length;
969
size = extended_apn_aggregate_maximum_bit_rate->length + sizeof(extended_apn_aggregate_maximum_bit_rate->length);
970
971
int ogs_nas_eps_decode_eps_quality_of_service(ogs_nas_eps_quality_of_service_t *eps_quality_of_service, ogs_pkbuf_t *pkbuf)
972
{
973
int size = 0;
974
- ogs_nas_eps_quality_of_service_t *source = (ogs_nas_eps_quality_of_service_t *)pkbuf->data;
975
+ ogs_nas_eps_quality_of_service_t *source = NULL;
976
+
977
+ if (pkbuf->len < 1) {
978
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
979
+ return -1;
980
+ }
981
+
982
+ source = (ogs_nas_eps_quality_of_service_t *)pkbuf->data;
983
984
eps_quality_of_service->length = source->length;
985
size = eps_quality_of_service->length + sizeof(eps_quality_of_service->length);
986
987
int ogs_nas_eps_decode_extended_quality_of_service(ogs_nas_extended_quality_of_service_t *extended_quality_of_service, ogs_pkbuf_t *pkbuf)
988
{
989
int size = 0;
990
- ogs_nas_extended_quality_of_service_t *source = (ogs_nas_extended_quality_of_service_t *)pkbuf->data;
991
+ ogs_nas_extended_quality_of_service_t *source = NULL;
992
+
993
+ if (pkbuf->len < 1) {
994
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
995
+ return -1;
996
+ }
997
+
998
+ source = (ogs_nas_extended_quality_of_service_t *)pkbuf->data;
999
1000
extended_quality_of_service->length = source->length;
1001
size = extended_quality_of_service->length + sizeof(extended_quality_of_service->length);
1002
1003
int ogs_nas_eps_decode_packet_flow_identifier(ogs_nas_packet_flow_identifier_t *packet_flow_identifier, ogs_pkbuf_t *pkbuf)
1004
{
1005
int size = 0;
1006
- ogs_nas_packet_flow_identifier_t *source = (ogs_nas_packet_flow_identifier_t *)pkbuf->data;
1007
+ ogs_nas_packet_flow_identifier_t *source = NULL;
1008
+
1009
+ if (pkbuf->len < 1) {
1010
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
1011
+ return -1;
1012
+ }
1013
+
1014
+ source = (ogs_nas_packet_flow_identifier_t *)pkbuf->data;
1015
1016
packet_flow_identifier->length = source->length;
1017
size = packet_flow_identifier->length + sizeof(packet_flow_identifier->length);
1018
1019
int ogs_nas_eps_decode_pdn_address(ogs_nas_pdn_address_t *pdn_address, ogs_pkbuf_t *pkbuf)
1020
{
1021
int size = 0;
1022
- ogs_nas_pdn_address_t *source = (ogs_nas_pdn_address_t *)pkbuf->data;
1023
+ ogs_nas_pdn_address_t *source = NULL;
1024
+
1025
+ if (pkbuf->len < 1) {
1026
+ ogs_error("Not enough pkbuf len:%d", pkbuf->len);
1027
+ return -1;
1028
+ }
1029
+
1030
+ source = (ogs_nas_pdn_address_t *)pkbuf->data;
1031
1032
pdn_address->length = source->length;
1033
size = pdn_address->length + sizeof(pdn_address->length);
1034
open5gs_2.7.2.4565.531e.tar.xz/lib/nas/eps/support/nas-message.py -> open5gs_2.7.2.4566.9251.tar.xz/lib/nas/eps/support/nas-message.py
Changed
29
1
2
f.write("int ogs_nas_eps_decode_%s(ogs_nas_%s_t *%s, ogs_pkbuf_t *pkbuf)\n" % (v_lower(k), v_lower(k), v_lower(k)))
3
f.write("{\n")
4
f.write(" int size = 0;\n")
5
- f.write(" ogs_nas_%s_t *source = (ogs_nas_%s_t *)pkbuf->data;\n\n" % (v_lower(k), v_lower(k)))
6
+ f.write(" ogs_nas_%s_t *source = NULL;\n\n" % v_lower(k))
7
+ f.write(" if (pkbuf->len < 2) {\n")
8
+ f.write(" ogs_error(\"Not enough pkbuf len:%d\", pkbuf->len);\n")
9
+ f.write(" return -1;\n")
10
+ f.write(" }\n\n")
11
+ f.write(" source = (ogs_nas_%s_t *)pkbuf->data;\n\n" % v_lower(k))
12
f.write(" %s->length = be16toh(source->length);\n" % v_lower(k))
13
f.write(" size = %s->length + sizeof(%s->length);\n\n" % (v_lower(k), v_lower(k)))
14
f.write(" if (ogs_pkbuf_pull(pkbuf, size) == NULL) {\n")
15
16
f.write("int ogs_nas_eps_decode_%s(ogs_nas_%s_t *%s, ogs_pkbuf_t *pkbuf)\n" % (v_lower(k), v_lower(k), v_lower(k)))
17
f.write("{\n")
18
f.write(" int size = 0;\n")
19
- f.write(" ogs_nas_%s_t *source = (ogs_nas_%s_t *)pkbuf->data;\n\n" % (v_lower(k), v_lower(k)))
20
+ f.write(" ogs_nas_%s_t *source = NULL;\n\n" % v_lower(k))
21
+ f.write(" if (pkbuf->len < 1) {\n")
22
+ f.write(" ogs_error(\"Not enough pkbuf len:%d\", pkbuf->len);\n")
23
+ f.write(" return -1;\n")
24
+ f.write(" }\n\n")
25
+ f.write(" source = (ogs_nas_%s_t *)pkbuf->data;\n\n" % v_lower(k))
26
f.write(" %s->length = source->length;\n" % v_lower(k))
27
f.write(" size = %s->length + sizeof(%s->length);\n\n" % (v_lower(k), v_lower(k)))
28
f.write(" if (ogs_pkbuf_pull(pkbuf, size) == NULL) {\n")
29