Commit 357763e3 authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen

Merge branch 'develop' into 'fqdn_dns'

# Conflicts:
#   build/scripts/build_helper.amf
parents 598b67f4 6071beb4
...@@ -75,6 +75,7 @@ install_boost_1_66() { ...@@ -75,6 +75,7 @@ install_boost_1_66() {
#arg1 is force (0 or 1) (no interactive script) #arg1 is force (0 or 1) (no interactive script)
#arg2 is debug (0 or 1) (install debug libraries) #arg2 is debug (0 or 1) (install debug libraries)
install_cpprestsdk_from_git() { install_cpprestsdk_from_git() {
echo "Starting to install cpprestsdk"
if [ $1 -eq 0 ]; then if [ $1 -eq 0 ]; then
read -p "Do you want to install C++ REST SDK ? <y/N> " prompt read -p "Do you want to install C++ REST SDK ? <y/N> " prompt
OPTION="-y" OPTION="-y"
...@@ -112,6 +113,7 @@ install_cpprestsdk_from_git() { ...@@ -112,6 +113,7 @@ install_cpprestsdk_from_git() {
$SUDO ldconfig -v $SUDO ldconfig -v
popd popd
fi fi
echo "cpprestsdk installation complete"
return 0 return 0
} }
...@@ -119,6 +121,7 @@ install_cpprestsdk_from_git() { ...@@ -119,6 +121,7 @@ install_cpprestsdk_from_git() {
#arg1 is force (0 or 1) (no interactive script) #arg1 is force (0 or 1) (no interactive script)
#arg2 is debug (0 or 1) (install debug libraries) #arg2 is debug (0 or 1) (install debug libraries)
install_fmt() { install_fmt() {
echo "Starting to install fmt"
if [ $1 -eq 0 ]; then if [ $1 -eq 0 ]; then
read -p "Do you want to install open-source formatting library for C++ ? <y/N> " prompt read -p "Do you want to install open-source formatting library for C++ ? <y/N> " prompt
OPTION="" OPTION=""
...@@ -147,6 +150,7 @@ install_fmt() { ...@@ -147,6 +150,7 @@ install_fmt() {
cd /tmp cd /tmp
rm -rf /tmp/fmt* rm -rf /tmp/fmt*
fi fi
echo "fmt installation complete"
return 0 return 0
} }
...@@ -154,6 +158,7 @@ install_fmt() { ...@@ -154,6 +158,7 @@ install_fmt() {
#arg1 is force (0 or 1) (no interactive script) #arg1 is force (0 or 1) (no interactive script)
#arg2 is debug (0 or 1) (install debug libraries) #arg2 is debug (0 or 1) (install debug libraries)
install_spdlog_from_git() { install_spdlog_from_git() {
echo "Starting to install spdlog"
if [ $1 -eq 0 ]; then if [ $1 -eq 0 ]; then
read -p "Do you want to install spdlog ? <y/N> " prompt read -p "Do you want to install spdlog ? <y/N> " prompt
OPTION="" OPTION=""
...@@ -186,6 +191,7 @@ install_spdlog_from_git() { ...@@ -186,6 +191,7 @@ install_spdlog_from_git() {
sed -i '/#define SPDLOG_ENABLE_SYSLOG/s/^\/\///g' include/spdlog/tweakme.h sed -i '/#define SPDLOG_ENABLE_SYSLOG/s/^\/\///g' include/spdlog/tweakme.h
popd popd
fi fi
echo "spdlog installation complete"
return 0 return 0
} }
...@@ -193,6 +199,7 @@ install_spdlog_from_git() { ...@@ -193,6 +199,7 @@ install_spdlog_from_git() {
#arg1 is force (0 or 1) (no interactive script) #arg1 is force (0 or 1) (no interactive script)
#arg2 is debug (0 or 1) (install debug libraries) #arg2 is debug (0 or 1) (install debug libraries)
install_pistache_from_git() { install_pistache_from_git() {
echo "Starting to install pistache"
if [ $1 -eq 0 ]; then if [ $1 -eq 0 ]; then
read -p "Do you want to install Pistache ? <y/N> " prompt read -p "Do you want to install Pistache ? <y/N> " prompt
OPTION="-y" OPTION="-y"
...@@ -235,6 +242,7 @@ install_pistache_from_git() { ...@@ -235,6 +242,7 @@ install_pistache_from_git() {
ret=$?;[[ $ret -ne 0 ]] && popd && return $ret ret=$?;[[ $ret -ne 0 ]] && popd && return $ret
popd popd
fi fi
echo "pistache installation complete"
return 0 return 0
} }
...@@ -242,6 +250,7 @@ install_pistache_from_git() { ...@@ -242,6 +250,7 @@ install_pistache_from_git() {
#arg1 is force (0 or 1) (no interactive script) #arg1 is force (0 or 1) (no interactive script)
#arg2 is debug (0 or 1) (install debug libraries) #arg2 is debug (0 or 1) (install debug libraries)
install_nlohmann_from_git() { install_nlohmann_from_git() {
echo "Starting to install Nlohmann Json"
if [ $1 -eq 0 ]; then if [ $1 -eq 0 ]; then
read -p "Do you want to install Nlohmann Json ? <y/N> " prompt read -p "Do you want to install Nlohmann Json ? <y/N> " prompt
OPTION="" OPTION=""
...@@ -280,6 +289,7 @@ install_nlohmann_from_git() { ...@@ -280,6 +289,7 @@ install_nlohmann_from_git() {
ret=$?;[[ $ret -ne 0 ]] && popd && return $ret ret=$?;[[ $ret -ne 0 ]] && popd && return $ret
popd popd
fi fi
echo "Nlohmann Json installation complete"
return 0 return 0
} }
...@@ -436,7 +446,8 @@ check_install_amf_deps(){ ...@@ -436,7 +446,8 @@ check_install_amf_deps(){
echo "Install distro libs" echo "Install distro libs"
$SUDO $INSTALLER install $OPTION $PACKAGE_LIST $SUDO $INSTALLER install $OPTION $PACKAGE_LIST
ret=$?;[[ $ret -ne 0 ]] && return $ret ret=$?;[[ $ret -ne 0 ]] && return $ret
echo "distro libs installation complete"
install_cpprestsdk_from_git $1 $2 install_cpprestsdk_from_git $1 $2
ret=$?;[[ $ret -ne 0 ]] && return $ret ret=$?;[[ $ret -ne 0 ]] && return $ret
......
...@@ -31,6 +31,7 @@ source $THIS_SCRIPT_PATH/build_helper ...@@ -31,6 +31,7 @@ source $THIS_SCRIPT_PATH/build_helper
#arg1 is force (0 or 1) (no interactive script) #arg1 is force (0 or 1) (no interactive script)
#arg2 is debug (0 or 1) (install debug libraries) #arg2 is debug (0 or 1) (install debug libraries)
install_fb_folly_from_source(){ install_fb_folly_from_source(){
echo "Starting to install folly"
if [ $1 -eq 0 ]; then if [ $1 -eq 0 ]; then
OPTION="" OPTION=""
read -p "Do you want to install FaceBook folly (github)? <y/N> " prompt read -p "Do you want to install FaceBook folly (github)? <y/N> " prompt
...@@ -49,7 +50,9 @@ install_fb_folly_from_source(){ ...@@ -49,7 +50,9 @@ install_fb_folly_from_source(){
then then
if [[ "$OS_BASEDISTRO" == "fedora" ]]; then if [[ "$OS_BASEDISTRO" == "fedora" ]]; then
$SUDO $INSTALLER install $OPTION \ $SUDO $INSTALLER install $OPTION \
gcc-c++ \
$CMAKE \ $CMAKE \
make \
boost-devel \ boost-devel \
libevent-devel \ libevent-devel \
double-conversion-devel \ double-conversion-devel \
...@@ -136,6 +139,6 @@ install_fb_folly_from_source(){ ...@@ -136,6 +139,6 @@ install_fb_folly_from_source(){
ret=$?;[[ $ret -ne 0 ]] && popd && return $ret ret=$?;[[ $ret -ne 0 ]] && popd && return $ret
popd popd
fi fi
echo_success "End of folly installation" echo_success "folly installation complete"
return 0 return 0
} }
...@@ -375,7 +375,7 @@ class HtmlReport(): ...@@ -375,7 +375,7 @@ class HtmlReport():
def buildSummaryFooter(self): def buildSummaryFooter(self):
self.file.write(' </table>\n') self.file.write(' </table>\n')
self.file.write(' <br>\n') self.file.write(' <br>\n')
if self.nb_warnings > 0: if len(self.warning_rows) > 0:
self.file.write(' <h3>Compilation Warnings Details</h3>\n') self.file.write(' <h3>Compilation Warnings Details</h3>\n')
self.file.write(' <button data-toggle="collapse" data-target="#oai-compilation-details">Details for Compilation Errors and Warnings </button>\n') self.file.write(' <button data-toggle="collapse" data-target="#oai-compilation-details">Details for Compilation Errors and Warnings </button>\n')
self.file.write(' <div id="oai-compilation-details" class="collapse">\n') self.file.write(' <div id="oai-compilation-details" class="collapse">\n')
...@@ -471,6 +471,8 @@ class HtmlReport(): ...@@ -471,6 +471,8 @@ class HtmlReport():
pistache_build_status = False pistache_build_status = False
json_build_start = False json_build_start = False
json_build_status = False json_build_status = False
cpprest_build_start = False
cpprest_build_status = False
base_image = False base_image = False
with open(cwd + '/archives/' + logFileName, 'r') as logfile: with open(cwd + '/archives/' + logFileName, 'r') as logfile:
for line in logfile: for line in logfile:
...@@ -487,33 +489,43 @@ class HtmlReport(): ...@@ -487,33 +489,43 @@ class HtmlReport():
result = re.search('AMF deps installation successful', line) result = re.search('AMF deps installation successful', line)
if result is not None: if result is not None:
status = True status = True
result = re.search('Install fmt from source', line) result = re.search('distro libs installation complete', line)
if result is not None: if result is not None:
package_install = True package_install = True
fmt_build_start = True result = re.search('Starting to install cpprestsdk', line)
result = re.search('Installing: /usr/local/lib/pkgconfig/fmt.pc', line) if result is not None:
cpprest_build_start = True
result = re.search('cpprestsdk installation complete', line)
if result is not None and cpprest_build_start:
cpprest_build_status = True
result = re.search('Starting to install fmt', line)
if result is not None: if result is not None:
fmt_build_start = True
result = re.search('fmt installation complete', line)
if result is not None and fmt_build_start:
fmt_build_status = True fmt_build_status = True
result = re.search('Cloning into \'folly\'', line) result = re.search('Starting to install folly', line)
if result is not None: if result is not None:
folly_build_start = True folly_build_start = True
result = re.search('Installing: /usr/local/lib/libfollybenchmark.a', line) result = re.search('folly installation complete', line)
if result is not None: if result is not None and folly_build_start:
folly_build_status = True folly_build_status = True
result = re.search('Install spdlog from', line) result = re.search('Starting to install spdlog', line)
if result is not None: if result is not None:
spdlog_build_start = True spdlog_build_start = True
result = re.search('Install Pistache from', line) result = re.search('spdlog installation complete', line)
if result is not None: if result is not None and spdlog_build_start:
spdlog_build_status = True spdlog_build_status = True
pistache_build_start = True result = re.search('Starting to install pistache', line)
result = re.search('Installing: /usr/local/lib/libpistache.a', line)
if result is not None: if result is not None:
pistache_build_start = True
result = re.search('pistache installation complete', line)
if result is not None and pistache_build_start:
pistache_build_status = True pistache_build_status = True
result = re.search('Install Nlohmann Json', line) result = re.search('Starting to install Nlohmann Json', line)
if result is not None: if result is not None:
json_build_status = True json_build_status = True
result = re.search('Installing: /usr/local/lib/cmake/nlohmann_json/nlohmann_jsonTargets.cmake', line) result = re.search('Nlohmann Json installation complete', line)
if result is not None: if result is not None:
json_build_status = True json_build_status = True
logfile.close() logfile.close()
...@@ -533,6 +545,12 @@ class HtmlReport(): ...@@ -533,6 +545,12 @@ class HtmlReport():
cell_msg += ' ** Packages Installation: OK\n' cell_msg += ' ** Packages Installation: OK\n'
else: else:
cell_msg += ' ** Packages Installation: KO\n' cell_msg += ' ** Packages Installation: KO\n'
if base_image:
cell_msg += ' ** cpprestsdk Installation: N/A\n'
elif cpprest_build_status:
cell_msg += ' ** cpprestsdk Installation: OK\n'
else:
cell_msg += ' ** cpprestsdk Installation: KO\n'
if base_image: if base_image:
cell_msg += ' ** fmt Installation: N/A\n' cell_msg += ' ** fmt Installation: N/A\n'
elif fmt_build_status: elif fmt_build_status:
...@@ -668,6 +686,11 @@ class HtmlReport(): ...@@ -668,6 +686,11 @@ class HtmlReport():
linenumber = re.sub(':[0-9]*:',"", linenumber) linenumber = re.sub(':[0-9]*:',"", linenumber)
error_warning_status = re.sub(':',"", wordsList[1]) error_warning_status = re.sub(':',"", wordsList[1])
error_warning_msg = re.sub('^.*' + error_warning_status + ':', '', correctLine) error_warning_msg = re.sub('^.*' + error_warning_status + ':', '', correctLine)
if nb_warnings == 0 and variant == 'docker':
self.warning_rows += '<tr><td colspan="4" align = "center" bgcolor = "LightGray"><b>Ubuntu 18</b></td></tr>\n'
if nb_warnings == 0 and variant == 'podman':
self.warning_rows += '<tr><td colspan="4" align = "center" bgcolor = "LightGray"><b>RHEL 8</b></td></tr>\n'
nb_warnings += 1 nb_warnings += 1
self.warning_rows += '<tr><td>' + filename + '</td><td>' + linenumber + '</td><td>' + error_warning_status + '</td><td>' + error_warning_msg + '</td></tr>\n' self.warning_rows += '<tr><td>' + filename + '</td><td>' + linenumber + '</td><td>' + error_warning_status + '</td><td>' + error_warning_msg + '</td></tr>\n'
logfile.close() logfile.close()
......
...@@ -59,15 +59,6 @@ RUN /bin/bash -c "if [[ -v NEEDED_GIT_PROXY ]]; then git config --global http.pr ...@@ -59,15 +59,6 @@ RUN /bin/bash -c "if [[ -v NEEDED_GIT_PROXY ]]; then git config --global http.pr
RUN git config --global https.postBuffer 123289600 RUN git config --global https.postBuffer 123289600
RUN git config --global http.sslverify false RUN git config --global http.sslverify false
# cpprest package install
RUN git clone https://github.com/Microsoft/cpprestsdk.git
RUN cd cpprestsdk && \
git submodule update --init && \
mkdir build && cd build && \
cmake3 -G Ninja .. -DCMAKE_BUILD_TYPE=Release && \
ninja install && \
ldconfig -v
# Copying source code # Copying source code
WORKDIR /openair-amf/ WORKDIR /openair-amf/
COPY . /openair-amf COPY . /openair-amf
......
...@@ -47,7 +47,7 @@ class ABBA { ...@@ -47,7 +47,7 @@ class ABBA {
private: private:
uint8_t _iei; uint8_t _iei;
uint8_t _length; uint8_t _length;
uint8_t _value[255]; uint8_t _value[256];
}; };
} // namespace nas } // namespace nas
......
...@@ -73,30 +73,30 @@ static const asn_ioc_cell_t ...@@ -73,30 +73,30 @@ static const asn_ioc_cell_t
static const asn_ioc_set_t static const asn_ioc_set_t
asn_IOS_Ngap_PDUSessionResourceModifyRequestTransferIEs_1[] = { asn_IOS_Ngap_PDUSessionResourceModifyRequestTransferIEs_1[] = {
{6, 4, asn_IOS_Ngap_PDUSessionResourceModifyRequestTransferIEs_1_rows}}; {6, 4, asn_IOS_Ngap_PDUSessionResourceModifyRequestTransferIEs_1_rows}};
static const long asn_VAL_7_Ngap_id_PDUSessionAggregateMaximumBitRate = 130; static const long asn_VAL_7_Ngap_id_PDUSessionAggregateMaximumBitRate = 130;
static const long asn_VAL_7_Ngap_reject = 0; static const long asn_VAL_7_Ngap_reject = 0;
static const long asn_VAL_7_Ngap_optional = 0; static const long asn_VAL_7_Ngap_optional = 0;
static const long asn_VAL_8_Ngap_id_UL_NGU_UP_TNLInformation = 139; static const long asn_VAL_8_Ngap_id_UL_NGU_UP_TNLInformation = 139;
static const long asn_VAL_8_Ngap_reject = 0; static const long asn_VAL_8_Ngap_reject = 0;
static const long asn_VAL_8_Ngap_mandatory = 2; static const long asn_VAL_8_Ngap_mandatory = 2;
static const long asn_VAL_9_Ngap_id_AdditionalUL_NGU_UP_TNLInformation = 126; // static const long asn_VAL_9_Ngap_id_AdditionalUL_NGU_UP_TNLInformation = 126;
static const long asn_VAL_9_Ngap_reject = 0; // static const long asn_VAL_9_Ngap_reject = 0;
static const long asn_VAL_9_Ngap_optional = 0; // static const long asn_VAL_9_Ngap_optional = 0;
static const long asn_VAL_10_Ngap_id_DataForwardingNotPossible = 127; static const long asn_VAL_10_Ngap_id_DataForwardingNotPossible = 127;
static const long asn_VAL_10_Ngap_reject = 0; static const long asn_VAL_10_Ngap_reject = 0;
static const long asn_VAL_10_Ngap_optional = 0; static const long asn_VAL_10_Ngap_optional = 0;
static const long asn_VAL_11_Ngap_id_PDUSessionType = 134; static const long asn_VAL_11_Ngap_id_PDUSessionType = 134;
static const long asn_VAL_11_Ngap_reject = 0; static const long asn_VAL_11_Ngap_reject = 0;
static const long asn_VAL_11_Ngap_mandatory = 2; static const long asn_VAL_11_Ngap_mandatory = 2;
static const long asn_VAL_12_Ngap_id_SecurityIndication = 138; static const long asn_VAL_12_Ngap_id_SecurityIndication = 138;
static const long asn_VAL_12_Ngap_reject = 0; static const long asn_VAL_12_Ngap_reject = 0;
static const long asn_VAL_12_Ngap_optional = 0; static const long asn_VAL_12_Ngap_optional = 0;
static const long asn_VAL_13_Ngap_id_NetworkInstance = 129; static const long asn_VAL_13_Ngap_id_NetworkInstance = 129;
static const long asn_VAL_13_Ngap_reject = 0; static const long asn_VAL_13_Ngap_reject = 0;
static const long asn_VAL_13_Ngap_optional = 0; static const long asn_VAL_13_Ngap_optional = 0;
static const long asn_VAL_14_Ngap_id_QosFlowSetupRequestList = 136; static const long asn_VAL_14_Ngap_id_QosFlowSetupRequestList = 136;
static const long asn_VAL_14_Ngap_reject = 0; static const long asn_VAL_14_Ngap_reject = 0;
static const long asn_VAL_14_Ngap_mandatory = 2; static const long asn_VAL_14_Ngap_mandatory = 2;
static const asn_ioc_cell_t static const asn_ioc_cell_t
asn_IOS_Ngap_PDUSessionResourceSetupRequestTransferIEs_1_rows[] = { asn_IOS_Ngap_PDUSessionResourceSetupRequestTransferIEs_1_rows[] = {
{"&id", aioc__value, &asn_DEF_Ngap_ProtocolIE_ID, {"&id", aioc__value, &asn_DEF_Ngap_ProtocolIE_ID,
...@@ -1146,7 +1146,7 @@ asn_enc_rval_t CHOICE_encode_aper( ...@@ -1146,7 +1146,7 @@ asn_enc_rval_t CHOICE_encode_aper(
return elm->type->op->aper_encoder( return elm->type->op->aper_encoder(
elm->type, elm->encoding_constraints.per_constraints, memb_ptr, po); elm->type, elm->encoding_constraints.per_constraints, memb_ptr, po);
} else { } else if (ct) {
asn_enc_rval_t rval; asn_enc_rval_t rval;
if (specs->ext_start == -1) ASN__ENCODE_FAILED; if (specs->ext_start == -1) ASN__ENCODE_FAILED;
if (aper_put_nsnnwn(po, ct->range_bits, present - specs->ext_start)) if (aper_put_nsnnwn(po, ct->range_bits, present - specs->ext_start))
...@@ -1156,6 +1156,8 @@ asn_enc_rval_t CHOICE_encode_aper( ...@@ -1156,6 +1156,8 @@ asn_enc_rval_t CHOICE_encode_aper(
ASN__ENCODE_FAILED; ASN__ENCODE_FAILED;
rval.encoded = 0; rval.encoded = 0;
ASN__ENCODED_OK(rval); ASN__ENCODED_OK(rval);
} else {
ASN__ENCODE_FAILED;
} }
} }
......
...@@ -94,6 +94,7 @@ void UEContextReleaseCompleteMsg::setAmfUeNgapId(unsigned long id) { ...@@ -94,6 +94,7 @@ void UEContextReleaseCompleteMsg::setAmfUeNgapId(unsigned long id) {
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
unsigned long UEContextReleaseCompleteMsg::getAmfUeNgapId() const { unsigned long UEContextReleaseCompleteMsg::getAmfUeNgapId() const {
if (amfUeNgapId) return amfUeNgapId->getAMF_UE_NGAP_ID(); if (amfUeNgapId) return amfUeNgapId->getAMF_UE_NGAP_ID();
return (unsigned long) 0;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
...@@ -121,6 +122,7 @@ void UEContextReleaseCompleteMsg::setRanUeNgapId(uint32_t ran_ue_ngap_id) { ...@@ -121,6 +122,7 @@ void UEContextReleaseCompleteMsg::setRanUeNgapId(uint32_t ran_ue_ngap_id) {
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
uint32_t UEContextReleaseCompleteMsg::getRanUeNgapId() const { uint32_t UEContextReleaseCompleteMsg::getRanUeNgapId() const {
if (ranUeNgapId) return ranUeNgapId->getRanUeNgapId(); if (ranUeNgapId) return ranUeNgapId->getRanUeNgapId();
return (uint32_t) 0;
} }
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
......
...@@ -85,9 +85,7 @@ int sctp_server::create_socket(const char* address, const uint16_t port_num) { ...@@ -85,9 +85,7 @@ int sctp_server::create_socket(const char* address, const uint16_t port_num) {
events_.sctp_data_io_event = 1; events_.sctp_data_io_event = 1;
events_.sctp_shutdown_event = 1; events_.sctp_shutdown_event = 1;
events_.sctp_association_event = 1; events_.sctp_association_event = 1;
setsockopt( setsockopt(socket_, IPPROTO_SCTP, SCTP_EVENTS, &events_, 8);
socket_, IPPROTO_SCTP, SCTP_EVENTS, &events_,
8);
listen(socket_, 5); listen(socket_, 5);
return 0; return 0;
} }
......
...@@ -164,7 +164,8 @@ int balloc(bstring b, int olen) { ...@@ -164,7 +164,8 @@ int balloc(bstring b, int olen) {
#if defined(BSTRLIB_TEST_CANARY) #if defined(BSTRLIB_TEST_CANARY)
if (len > b->slen + 1) { if (len > b->slen + 1) {
memchr(b->data + b->slen + 1, 'X', len - (b->slen + 1)); if ((memchr(b->data + b->slen + 1, 'X', len - (b->slen + 1))) == NULL)
return BSTR_ERR;
} }
#endif #endif
} }
...@@ -218,7 +219,8 @@ bstring bfromcstr(const char* str) { ...@@ -218,7 +219,8 @@ bstring bfromcstr(const char* str) {
b = (bstring) bstr__alloc(sizeof(struct tagbstring)); b = (bstring) bstr__alloc(sizeof(struct tagbstring));
if (NULL == b) return NULL; if (NULL == b) return NULL;
b->slen = (int) j; b->slen = (int) j;
if (NULL == (b->data = (unsigned char*) bstr__alloc(b->mlen = i))) { b->data = (unsigned char*) bstr__alloc(b->mlen = i);
if (b->data == NULL) {
bstr__free(b); bstr__free(b);
return NULL; return NULL;
} }
...@@ -1588,7 +1590,8 @@ int binsertblk( ...@@ -1588,7 +1590,8 @@ int binsertblk(
/* Aliasing case */ /* Aliasing case */
if (((size_t)((unsigned char*) blk + len)) >= ((size_t) b->data) && if (((size_t)((unsigned char*) blk + len)) >= ((size_t) b->data) &&
((size_t) blk) < ((size_t)(b->data + b->mlen))) { ((size_t) blk) < ((size_t)(b->data + b->mlen))) {
if (NULL == (aux = (unsigned char*) bstr__alloc(len))) return BSTR_ERR; aux = (unsigned char*) bstr__alloc(len);
if (aux == NULL) return BSTR_ERR;
bstr__memcpy(aux, blk, len); bstr__memcpy(aux, blk, len);
} }
...@@ -2133,6 +2136,9 @@ int bsreadlna(bstring r, struct bStream* s, char terminator) { ...@@ -2133,6 +2136,9 @@ int bsreadlna(bstring r, struct bStream* s, char terminator) {
int i, l, ret, rlo; int i, l, ret, rlo;
char* b; char* b;
struct tagbstring x; struct tagbstring x;
x.mlen = 0;
x.slen = 0;
x.data = NULL;
if (s == NULL || s->buff == NULL || r == NULL || r->mlen <= 0 || if (s == NULL || s->buff == NULL || r == NULL || r->mlen <= 0 ||
r->slen < 0 || r->mlen < r->slen) r->slen < 0 || r->mlen < r->slen)
...@@ -2201,6 +2207,9 @@ int bsreadlnsa(bstring r, struct bStream* s, const_bstring term) { ...@@ -2201,6 +2207,9 @@ int bsreadlnsa(bstring r, struct bStream* s, const_bstring term) {
unsigned char* b; unsigned char* b;
struct tagbstring x; struct tagbstring x;
struct charField cf; struct charField cf;
x.mlen = 0;
x.slen = 0;
x.data = NULL;
if (s == NULL || s->buff == NULL || r == NULL || term == NULL || if (s == NULL || s->buff == NULL || r == NULL || term == NULL ||
term->data == NULL || r->mlen <= 0 || r->slen < 0 || r->mlen < r->slen) term->data == NULL || r->mlen <= 0 || r->slen < 0 || r->mlen < r->slen)
...@@ -2470,7 +2479,10 @@ bstring bjoinblk(const struct bstrList* bl, const void* blk, int len) { ...@@ -2470,7 +2479,10 @@ bstring bjoinblk(const struct bstrList* bl, const void* blk, int len) {
* NULL is returned, otherwise a bstring with the correct result is returned. * NULL is returned, otherwise a bstring with the correct result is returned.
*/ */
bstring bjoin(const struct bstrList* bl, const_bstring sep) { bstring bjoin(const struct bstrList* bl, const_bstring sep) {
if (sep != NULL && (sep->slen < 0 || sep->data == NULL)) return NULL; if (sep == NULL)
return NULL;
else if (sep->slen < 0 || sep->data == NULL)
return NULL;
return bjoinblk(bl, sep->data, sep->slen); return bjoinblk(bl, sep->data, sep->slen);
} }
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment