Enforce limits on utf8 strings.
This commit is contained in:
+33
-1
@@ -8,12 +8,44 @@
|
||||
|
||||
#include "AnonymousLogin.h"
|
||||
|
||||
static int
|
||||
memb_playerName_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
|
||||
asn_app_constraint_failed_f *ctfailcb, void *app_key) {
|
||||
const UTF8String_t *st = (const UTF8String_t *)sptr;
|
||||
size_t size;
|
||||
|
||||
if(!sptr) {
|
||||
_ASN_CTFAIL(app_key, td, sptr,
|
||||
"%s: value not given (%s:%d)",
|
||||
td->name, __FILE__, __LINE__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
size = UTF8String_length(st);
|
||||
if((ssize_t)size < 0) {
|
||||
_ASN_CTFAIL(app_key, td, sptr,
|
||||
"%s: UTF-8: broken encoding (%s:%d)",
|
||||
td->name, __FILE__, __LINE__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if((size >= 1 && size <= 64)) {
|
||||
/* Constraint check succeeded */
|
||||
return 0;
|
||||
} else {
|
||||
_ASN_CTFAIL(app_key, td, sptr,
|
||||
"%s: constraint failed (%s:%d)",
|
||||
td->name, __FILE__, __LINE__);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
static asn_TYPE_member_t asn_MBR_AnonymousLogin_1[] = {
|
||||
{ ATF_NOFLAGS, 0, offsetof(struct AnonymousLogin, playerName),
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (12 << 2)),
|
||||
0,
|
||||
&asn_DEF_UTF8String,
|
||||
0, /* Defer constraints checking to the member type */
|
||||
memb_playerName_constraint_1,
|
||||
0, /* PER is not compiled, use -gen-PER */
|
||||
0,
|
||||
"playerName"
|
||||
|
||||
+33
-1
@@ -8,12 +8,44 @@
|
||||
|
||||
#include "AuthenticatedLogin.h"
|
||||
|
||||
static int
|
||||
memb_playerName_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
|
||||
asn_app_constraint_failed_f *ctfailcb, void *app_key) {
|
||||
const UTF8String_t *st = (const UTF8String_t *)sptr;
|
||||
size_t size;
|
||||
|
||||
if(!sptr) {
|
||||
_ASN_CTFAIL(app_key, td, sptr,
|
||||
"%s: value not given (%s:%d)",
|
||||
td->name, __FILE__, __LINE__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
size = UTF8String_length(st);
|
||||
if((ssize_t)size < 0) {
|
||||
_ASN_CTFAIL(app_key, td, sptr,
|
||||
"%s: UTF-8: broken encoding (%s:%d)",
|
||||
td->name, __FILE__, __LINE__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if((size >= 1 && size <= 64)) {
|
||||
/* Constraint check succeeded */
|
||||
return 0;
|
||||
} else {
|
||||
_ASN_CTFAIL(app_key, td, sptr,
|
||||
"%s: constraint failed (%s:%d)",
|
||||
td->name, __FILE__, __LINE__);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
static asn_TYPE_member_t asn_MBR_AuthenticatedLogin_1[] = {
|
||||
{ ATF_NOFLAGS, 0, offsetof(struct AuthenticatedLogin, playerName),
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (12 << 2)),
|
||||
0,
|
||||
&asn_DEF_UTF8String,
|
||||
0, /* Defer constraints checking to the member type */
|
||||
memb_playerName_constraint_1,
|
||||
0, /* PER is not compiled, use -gen-PER */
|
||||
0,
|
||||
"playerName"
|
||||
|
||||
Vendored
+33
-1
@@ -8,6 +8,38 @@
|
||||
|
||||
#include "ChatMessage.h"
|
||||
|
||||
static int
|
||||
memb_chatText_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
|
||||
asn_app_constraint_failed_f *ctfailcb, void *app_key) {
|
||||
const UTF8String_t *st = (const UTF8String_t *)sptr;
|
||||
size_t size;
|
||||
|
||||
if(!sptr) {
|
||||
_ASN_CTFAIL(app_key, td, sptr,
|
||||
"%s: value not given (%s:%d)",
|
||||
td->name, __FILE__, __LINE__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
size = UTF8String_length(st);
|
||||
if((ssize_t)size < 0) {
|
||||
_ASN_CTFAIL(app_key, td, sptr,
|
||||
"%s: UTF-8: broken encoding (%s:%d)",
|
||||
td->name, __FILE__, __LINE__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if((size >= 1 && size <= 128)) {
|
||||
/* Constraint check succeeded */
|
||||
return 0;
|
||||
} else {
|
||||
_ASN_CTFAIL(app_key, td, sptr,
|
||||
"%s: constraint failed (%s:%d)",
|
||||
td->name, __FILE__, __LINE__);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
static asn_TYPE_member_t asn_MBR_ChatMessage_1[] = {
|
||||
{ ATF_NOFLAGS, 0, offsetof(struct ChatMessage, playerId),
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (2 << 2)),
|
||||
@@ -31,7 +63,7 @@ static asn_TYPE_member_t asn_MBR_ChatMessage_1[] = {
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (12 << 2)),
|
||||
0,
|
||||
&asn_DEF_UTF8String,
|
||||
0, /* Defer constraints checking to the member type */
|
||||
memb_chatText_constraint_1,
|
||||
0, /* PER is not compiled, use -gen-PER */
|
||||
0,
|
||||
"chatText"
|
||||
|
||||
+33
-1
@@ -8,6 +8,38 @@
|
||||
|
||||
#include "ChatRequestMessage.h"
|
||||
|
||||
static int
|
||||
memb_chatText_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
|
||||
asn_app_constraint_failed_f *ctfailcb, void *app_key) {
|
||||
const UTF8String_t *st = (const UTF8String_t *)sptr;
|
||||
size_t size;
|
||||
|
||||
if(!sptr) {
|
||||
_ASN_CTFAIL(app_key, td, sptr,
|
||||
"%s: value not given (%s:%d)",
|
||||
td->name, __FILE__, __LINE__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
size = UTF8String_length(st);
|
||||
if((ssize_t)size < 0) {
|
||||
_ASN_CTFAIL(app_key, td, sptr,
|
||||
"%s: UTF-8: broken encoding (%s:%d)",
|
||||
td->name, __FILE__, __LINE__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if((size >= 1 && size <= 128)) {
|
||||
/* Constraint check succeeded */
|
||||
return 0;
|
||||
} else {
|
||||
_ASN_CTFAIL(app_key, td, sptr,
|
||||
"%s: constraint failed (%s:%d)",
|
||||
td->name, __FILE__, __LINE__);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
static asn_TYPE_member_t asn_MBR_ChatRequestMessage_1[] = {
|
||||
{ ATF_NOFLAGS, 0, offsetof(struct ChatRequestMessage, gameId),
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (2 << 2)),
|
||||
@@ -22,7 +54,7 @@ static asn_TYPE_member_t asn_MBR_ChatRequestMessage_1[] = {
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (12 << 2)),
|
||||
0,
|
||||
&asn_DEF_UTF8String,
|
||||
0, /* Defer constraints checking to the member type */
|
||||
memb_chatText_constraint_1,
|
||||
0, /* PER is not compiled, use -gen-PER */
|
||||
0,
|
||||
"chatText"
|
||||
|
||||
Vendored
+33
-1
@@ -8,12 +8,44 @@
|
||||
|
||||
#include "DialogMessage.h"
|
||||
|
||||
static int
|
||||
memb_notificationText_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
|
||||
asn_app_constraint_failed_f *ctfailcb, void *app_key) {
|
||||
const UTF8String_t *st = (const UTF8String_t *)sptr;
|
||||
size_t size;
|
||||
|
||||
if(!sptr) {
|
||||
_ASN_CTFAIL(app_key, td, sptr,
|
||||
"%s: value not given (%s:%d)",
|
||||
td->name, __FILE__, __LINE__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
size = UTF8String_length(st);
|
||||
if((ssize_t)size < 0) {
|
||||
_ASN_CTFAIL(app_key, td, sptr,
|
||||
"%s: UTF-8: broken encoding (%s:%d)",
|
||||
td->name, __FILE__, __LINE__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if((size >= 1 && size <= 128)) {
|
||||
/* Constraint check succeeded */
|
||||
return 0;
|
||||
} else {
|
||||
_ASN_CTFAIL(app_key, td, sptr,
|
||||
"%s: constraint failed (%s:%d)",
|
||||
td->name, __FILE__, __LINE__);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
static asn_TYPE_member_t asn_MBR_DialogMessage_1[] = {
|
||||
{ ATF_NOFLAGS, 0, offsetof(struct DialogMessage, notificationText),
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (12 << 2)),
|
||||
0,
|
||||
&asn_DEF_UTF8String,
|
||||
0, /* Defer constraints checking to the member type */
|
||||
memb_notificationText_constraint_1,
|
||||
0, /* PER is not compiled, use -gen-PER */
|
||||
0,
|
||||
"notificationText"
|
||||
|
||||
+33
-1
@@ -8,6 +8,38 @@
|
||||
|
||||
#include "JoinGameRequestMessage.h"
|
||||
|
||||
static int
|
||||
memb_password_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
|
||||
asn_app_constraint_failed_f *ctfailcb, void *app_key) {
|
||||
const UTF8String_t *st = (const UTF8String_t *)sptr;
|
||||
size_t size;
|
||||
|
||||
if(!sptr) {
|
||||
_ASN_CTFAIL(app_key, td, sptr,
|
||||
"%s: value not given (%s:%d)",
|
||||
td->name, __FILE__, __LINE__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
size = UTF8String_length(st);
|
||||
if((ssize_t)size < 0) {
|
||||
_ASN_CTFAIL(app_key, td, sptr,
|
||||
"%s: UTF-8: broken encoding (%s:%d)",
|
||||
td->name, __FILE__, __LINE__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if((size >= 1 && size <= 64)) {
|
||||
/* Constraint check succeeded */
|
||||
return 0;
|
||||
} else {
|
||||
_ASN_CTFAIL(app_key, td, sptr,
|
||||
"%s: constraint failed (%s:%d)",
|
||||
td->name, __FILE__, __LINE__);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
static asn_TYPE_member_t asn_MBR_joinGameAction_2[] = {
|
||||
{ ATF_NOFLAGS, 0, offsetof(struct joinGameAction, choice.joinExistingGame),
|
||||
(ASN_TAG_CLASS_CONTEXT | (0 << 2)),
|
||||
@@ -79,7 +111,7 @@ static asn_TYPE_member_t asn_MBR_JoinGameRequestMessage_1[] = {
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (12 << 2)),
|
||||
0,
|
||||
&asn_DEF_UTF8String,
|
||||
0, /* Defer constraints checking to the member type */
|
||||
memb_password_constraint_1,
|
||||
0, /* PER is not compiled, use -gen-PER */
|
||||
0,
|
||||
"password"
|
||||
|
||||
Vendored
+33
-1
@@ -156,6 +156,38 @@ memb_NativeInteger_constraint_17(asn_TYPE_descriptor_t *td, const void *sptr,
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
memb_gameName_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
|
||||
asn_app_constraint_failed_f *ctfailcb, void *app_key) {
|
||||
const UTF8String_t *st = (const UTF8String_t *)sptr;
|
||||
size_t size;
|
||||
|
||||
if(!sptr) {
|
||||
_ASN_CTFAIL(app_key, td, sptr,
|
||||
"%s: value not given (%s:%d)",
|
||||
td->name, __FILE__, __LINE__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
size = UTF8String_length(st);
|
||||
if((ssize_t)size < 0) {
|
||||
_ASN_CTFAIL(app_key, td, sptr,
|
||||
"%s: UTF-8: broken encoding (%s:%d)",
|
||||
td->name, __FILE__, __LINE__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if((size >= 1 && size <= 64)) {
|
||||
/* Constraint check succeeded */
|
||||
return 0;
|
||||
} else {
|
||||
_ASN_CTFAIL(app_key, td, sptr,
|
||||
"%s: constraint failed (%s:%d)",
|
||||
td->name, __FILE__, __LINE__);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
static int
|
||||
memb_maxNumPlayers_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
|
||||
asn_app_constraint_failed_f *ctfailcb, void *app_key) {
|
||||
@@ -484,7 +516,7 @@ static asn_TYPE_member_t asn_MBR_NetGameInfo_1[] = {
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (12 << 2)),
|
||||
0,
|
||||
&asn_DEF_UTF8String,
|
||||
0, /* Defer constraints checking to the member type */
|
||||
memb_gameName_constraint_1,
|
||||
0, /* PER is not compiled, use -gen-PER */
|
||||
0,
|
||||
"gameName"
|
||||
|
||||
+33
-1
@@ -8,6 +8,38 @@
|
||||
|
||||
#include "PlayerInfoData.h"
|
||||
|
||||
static int
|
||||
memb_playerName_constraint_1(asn_TYPE_descriptor_t *td, const void *sptr,
|
||||
asn_app_constraint_failed_f *ctfailcb, void *app_key) {
|
||||
const UTF8String_t *st = (const UTF8String_t *)sptr;
|
||||
size_t size;
|
||||
|
||||
if(!sptr) {
|
||||
_ASN_CTFAIL(app_key, td, sptr,
|
||||
"%s: value not given (%s:%d)",
|
||||
td->name, __FILE__, __LINE__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
size = UTF8String_length(st);
|
||||
if((ssize_t)size < 0) {
|
||||
_ASN_CTFAIL(app_key, td, sptr,
|
||||
"%s: UTF-8: broken encoding (%s:%d)",
|
||||
td->name, __FILE__, __LINE__);
|
||||
return -1;
|
||||
}
|
||||
|
||||
if((size >= 1 && size <= 64)) {
|
||||
/* Constraint check succeeded */
|
||||
return 0;
|
||||
} else {
|
||||
_ASN_CTFAIL(app_key, td, sptr,
|
||||
"%s: constraint failed (%s:%d)",
|
||||
td->name, __FILE__, __LINE__);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
static asn_TYPE_member_t asn_MBR_avatarData_4[] = {
|
||||
{ ATF_NOFLAGS, 0, offsetof(struct avatarData, avatarType),
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (10 << 2)),
|
||||
@@ -74,7 +106,7 @@ static asn_TYPE_member_t asn_MBR_PlayerInfoData_1[] = {
|
||||
(ASN_TAG_CLASS_UNIVERSAL | (12 << 2)),
|
||||
0,
|
||||
&asn_DEF_UTF8String,
|
||||
0, /* Defer constraints checking to the member type */
|
||||
memb_playerName_constraint_1,
|
||||
0, /* PER is not compiled, use -gen-PER */
|
||||
0,
|
||||
"playerName"
|
||||
|
||||
Reference in New Issue
Block a user