[Git][NTPsec/ntpsec][master] 2 commits: A missing casts found by clang.
Gary E. Miller
gitlab at mg.gitlab.com
Thu Feb 16 01:14:19 UTC 2017
Gary E. Miller pushed to branch master at NTPsec / ntpsec
Commits:
7834b99f by Gary E. Miller at 2017-02-15T15:17:18-08:00
A missing casts found by clang.
- - - - -
7d1623f5 by Gary E. Miller at 2017-02-15T17:09:30-08:00
waf: test for LDFLAGS instead assuming by version numbers.
Thanks to Matt Selsky for the idea.
- - - - -
2 changed files:
- libparse/clk_meinberg.c
- wafhelpers/configure.py
Changes:
=====================================
libparse/clk_meinberg.c
=====================================
--- a/libparse/clk_meinberg.c
+++ b/libparse/clk_meinberg.c
@@ -596,7 +596,8 @@ gps_input(
}
parseio->parse_dtime.parse_msglen = 1; /* reset buffer pointer */
- parseio->parse_dtime.parse_msg[0] = ch; /* fill in first character */
+ /* fill in first character */
+ parseio->parse_dtime.parse_msg[0] = (unsigned char)ch;
parseio->parse_dtime.parse_stime = *tstamp; /* collect timestamp */
return PARSE_INP_SKIP;
}
@@ -608,7 +609,8 @@ gps_input(
(parseio->parse_index < parseio->parse_dsize))
parseio->parse_data[parseio->parse_index++] = ch;
- parseio->parse_dtime.parse_msg[parseio->parse_dtime.parse_msglen++] = ch;
+ parseio->parse_dtime.parse_msg[parseio->parse_dtime.parse_msglen++] \
+ = (unsigned char)ch;
if (parseio->parse_dtime.parse_msglen > sizeof(parseio->parse_dtime.parse_msg))
{
=====================================
wafhelpers/configure.py
=====================================
--- a/wafhelpers/configure.py
+++ b/wafhelpers/configure.py
@@ -211,6 +211,33 @@ def cmd_configure(ctx, config):
"-Wstrict-prototypes",
]
+ # Check which linker flags are supported
+ ld_hardening_flags = [
+ ("-z now", "-Wl,-z,now"), # no deferred symbol resolution
+ ]
+ if not ctx.options.disable_debug:
+ # not debugging
+ ld_hardening_flags += [
+ ('--strip-all', "-Wl,--strip-all"), # Strip binaries
+ ]
+
+ # old gcc takes -z,relro, but then barfs is -fPIE available and used.
+ # ("relro", "-Wl,-z,relro"), # marks some sections read only
+
+ for (name, ldflag) in ld_hardening_flags:
+ cmd = [ctx.env.CC_NAME, ldflag]
+ #print("cmd: %s" % cmd)
+ ctx.start_msg("Checking if linker supports hardening flag: %s" % name)
+ try:
+ ctx.cmd_and_log(cmd)
+ except Exception as e:
+ if not any(word in e.stderr for word
+ in ['ignored', 'illegal', 'unknown', 'unrecognized']):
+ ctx.env.LDFLAGS += [ldflag]
+ ctx.end_msg("yes")
+ else:
+ ctx.end_msg("no", color="YELLOW")
+
# We require some things that C99 doesn't enable, like pthreads.
# Thus -std=gnu99 rather than -std=c99 here, if the compiler supports
# it.
@@ -232,14 +259,8 @@ def cmd_configure(ctx, config):
"-fsanitize=safe-stack", # hardening
]
ctx.env.LDFLAGS += [
- "-Wl,-z,now", # hardening, no deferred symbol resolution
"-Wl,-z,relro", # hardening, marks some section read only,
]
- if ctx.options.disable_debug:
- # not debugging
- ctx.env.LDFLAGS += [
- "-Wl,--strip-all", # Strip binaries
- ]
else:
# gcc, probably
# -O1 will turn on -D_FORTIFY_SOURCE=2 for us
@@ -248,9 +269,6 @@ def cmd_configure(ctx, config):
"-O1",
"-std=gnu99",
]
- ctx.env.LDFLAGS += [
- "-Wl,-z,now", # hardening, no deferred symbol resolution
- ]
if 5 <= int(ctx.env.CC_VERSION[0]):
# gcc >= 5.0
@@ -264,12 +282,6 @@ def cmd_configure(ctx, config):
"-Wl,-z,relro", # hardening, marks some section read only,
]
- if ctx.options.disable_debug:
- # not debugging
- ctx.env.LDFLAGS += [
- "-Wl,-z,strip-all", # Strip binaries
- ]
-
# XXX: hack
if ctx.env.DEST_OS in ["freebsd", "openbsd"]:
ctx.env.PLATFORM_INCLUDES = ["/usr/local/include"]
View it on GitLab: https://gitlab.com/NTPsec/ntpsec/compare/d9be7095c65d386c636d09cf54f63c1526e61893...7d1623f5234195f9d7d79e463ee13353d97d1ad2
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.ntpsec.org/pipermail/vc/attachments/20170216/9f3c7397/attachment.html>
More information about the vc
mailing list