diff --git a/interfaces/innerkits/acl/native/BUILD.gn b/interfaces/innerkits/acl/native/BUILD.gn index dcbd052e..07efffe8 100644 --- a/interfaces/innerkits/acl/native/BUILD.gn +++ b/interfaces/innerkits/acl/native/BUILD.gn @@ -52,6 +52,11 @@ ohos_shared_library("storage_manager_acl") { configs = [ ":private_config" ] public_configs = [ ":public_config" ] + cflags = [ + "-D_FORTIFY_SOURCE=2", + "-fstack-protector-strong", + ] + external_deps = [ "c_utils:utils", "hilog:libhilog", diff --git a/interfaces/innerkits/storage_manager/native/BUILD.gn b/interfaces/innerkits/storage_manager/native/BUILD.gn index bb41c034..58277043 100644 --- a/interfaces/innerkits/storage_manager/native/BUILD.gn +++ b/interfaces/innerkits/storage_manager/native/BUILD.gn @@ -56,6 +56,11 @@ ohos_shared_library("storage_manager_sa_proxy") { configs = [ ":private_config" ] public_configs = [ ":public_config" ] + cflags = [ + "-D_FORTIFY_SOURCE=2", + "-fstack-protector-strong", + ] + external_deps = [ "c_utils:utils", "hilog:libhilog", diff --git a/interfaces/kits/js/storage_manager/BUILD.gn b/interfaces/kits/js/storage_manager/BUILD.gn index 78e225d0..3564e0b9 100644 --- a/interfaces/kits/js/storage_manager/BUILD.gn +++ b/interfaces/kits/js/storage_manager/BUILD.gn @@ -41,6 +41,11 @@ ohos_shared_library("storagestatistics") { "${storage_service_path}/services/common/include", ] + cflags = [ + "-D_FORTIFY_SOURCE=2", + "-fstack-protector-strong", + ] + sources = [ "${storage_service_path}/services/storage_manager/kits_impl/src/storage_manager_connect.cpp", "${storage_service_path}/services/storage_manager/kits_impl/src/storage_statistics_n_exporter.cpp", @@ -84,6 +89,11 @@ ohos_shared_library("volumemanager") { "${storage_service_path}/services/common/include", ] + cflags = [ + "-D_FORTIFY_SOURCE=2", + "-fstack-protector-strong", + ] + sources = [ "${storage_service_path}/services/storage_manager/kits_impl/src/storage_manager_connect.cpp", "${storage_service_path}/services/storage_manager/kits_impl/src/volumemanager_n_exporter.cpp", diff --git a/services/storage_daemon/BUILD.gn b/services/storage_daemon/BUILD.gn index 790630c8..5e4f1fab 100644 --- a/services/storage_daemon/BUILD.gn +++ b/services/storage_daemon/BUILD.gn @@ -257,6 +257,11 @@ ohos_shared_library("storage_common_utils") { "LOG_DOMAIN = 0xD004301", ] + cflags = [ + "-D_FORTIFY_SOURCE=2", + "-fstack-protector-strong", + ] + sources = [ "./utils/disk_utils.cpp", "./utils/file_utils.cpp", diff --git a/services/storage_manager/BUILD.gn b/services/storage_manager/BUILD.gn index 55c9358e..4276e142 100644 --- a/services/storage_manager/BUILD.gn +++ b/services/storage_manager/BUILD.gn @@ -22,6 +22,11 @@ config("storage_manager_config") { "../storage_daemon/include", "../common/include", ] + + cflags = [ + "-D_FORTIFY_SOURCE=2", + "-fstack-protector-strong", + ] } ohos_shared_library("storage_manager") {