Skip to content

Commit

Permalink
www/chromium: fix obtaining HOST_NAME_MAX
Browse files Browse the repository at this point in the history
Using sysconf(3) API lead to accidental introduction of variable length arrays
(VLA) in the port. Additionally gethostname(3) has been passed _SC_HOST_NAME_MAX
incorrectly as the HOST_NAME_MAX length.

Fall back to using _POSIX_HOST_NAME_MAX as the remaining code is not ready for
introducing sysconf(3) as a patch.

Bump PORTREVISION to rebuild with the new patch.

Reviewed by:	bapt
Sponsored by:	Fudo Security
Differential Revision:	https://reviews.freebsd.org/D30062
  • Loading branch information
mulander authored and oshogbo committed Dec 15, 2021
1 parent c134ad7 commit a33ecd7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 6 deletions.
2 changes: 1 addition & 1 deletion www/chromium/Makefile
Expand Up @@ -2,7 +2,7 @@

PORTNAME= chromium
PORTVERSION= 94.0.4606.81
PORTREVISION= 2
PORTREVISION= 3
CATEGORIES= www
MASTER_SITES= https://commondatastorage.googleapis.com/chromium-browser-official/ \
LOCAL/rene/chromium/:fonts
Expand Down
@@ -1,14 +1,13 @@
--- components/sync_device_info/local_device_info_util_linux.cc.orig 2021-04-14 18:41:01 UTC
--- components/sync_device_info/local_device_info_util_linux.cc.orig 2021-04-27 04:07:31 UTC
+++ components/sync_device_info/local_device_info_util_linux.cc
@@ -38,8 +38,9 @@ std::string GetPersonalizableDeviceNameInternal() {
@@ -38,8 +38,8 @@ std::string GetPersonalizableDeviceNameInternal() {
#if BUILDFLAG(IS_CHROMEOS_ASH)
return GetChromeOSDeviceNameFromType();
#else
- char hostname[HOST_NAME_MAX];
- if (gethostname(hostname, HOST_NAME_MAX) == 0) // Success.
+ int len = sysconf(_SC_HOST_NAME_MAX);
+ char hostname[len];
+ if (gethostname(hostname, _SC_HOST_NAME_MAX) == 0) // Success.
+ char hostname[_POSIX_HOST_NAME_MAX];
+ if (gethostname(hostname, _POSIX_HOST_NAME_MAX) == 0) // Success.
return hostname;
return base::GetLinuxDistro();
#endif

0 comments on commit a33ecd7

Please sign in to comment.