Commit Graph

134 Commits

Author SHA1 Message Date
Hiltjo Posthuma
058547e707 util: trim() fix for UB on pointer arithmetic
Follow-up fix on commit df4c061136

"
While it is true reversing the condition solves a single-byte read at
one before s, there is a second instance of UB.

Having a pointer to one before an object is in of itself UB in C, it's
on the side of language lawyering, but it's UB.
I add here a quote from a C standard draft:
> When an expression that has integer type is added to or subtracted
> from a pointer, the result has the type of the pointer operand.
> If both the pointer operand and the result point to elements of the
> same array object, or one past the last element of the array object,
> the evaluation shall not produce an overflow; otherwise, the
> behavior is undefined.
Taken from: http://www.iso-9899.info/n1570.html#6.5.6p8
"

Thanks Guilherme Janczak <guilherme.janczak@yandex.com>
2021-05-06 12:20:30 +02:00
Hiltjo Posthuma
68c1c4e511 README: fix a minor typo and make a small rewording 2021-05-06 01:47:08 +02:00
Hiltjo Posthuma
f2c5daa9fe Makefile improvements
- Respect system/port flags by default.
- Be verbose and do not hide output. This makes it easier to debug a build.
- Remove the "options" target.
- Remove config.mk: just edit the Makefile or override flags if needed.
- dist: no need to clean before packaging files.
- dist: pipe directly to gzip without an intermediate tarball file.
- Define and add a POSIX marker to the Makefile.
2021-05-06 01:45:51 +02:00
Hiltjo Posthuma
81533f966e util: dial: no need for a static struct hints 2021-05-06 01:16:13 +02:00
Hiltjo Posthuma
b188c78432 util: fix a shadowed variable name srv 2021-05-06 01:14:21 +02:00
Hiltjo Posthuma
d9bda20849 fix undefined behaviour of using isspace ctype function
cast all ctype(3) functions argument to (unsigned char) to avoid UB

POSIX says:
"The c argument is an int, the value of which the application shall ensure is a
character representable as an unsigned char or equal to the value of the macro
EOF. If the argument has any other value, the behavior is undefined."

Many libc cast implicitly the value, but NetBSD for example does not, which is
probably the correct thing to interpret it.
2021-05-06 01:09:21 +02:00
Hiltjo Posthuma
df4c061136 fix an out-of-bounds read if the input is ""
Notified by Guilherme Janczak <guilherme.janczak@yandex.com>, thanks!
2021-05-06 01:04:35 +02:00
Hiltjo Posthuma
ec293427a0 fix include: include sys/select.h for select(2) and FD_(ZERO|SET)
Reported by nonterminal on IRC, thanks!
2020-10-11 14:51:35 +02:00
Anselm R Garbe
9bb34de449 added Joerg Jung's pledge patch 2017-03-18 19:24:55 +01:00
Anselm R Garbe
7f0141bbe9 applied Troels unbuffer stdin patch, thanks 2014-12-22 11:34:35 +01:00
Anselm R Garbe
6ae3c37e30 fix dist target, thanks Dimitris! 2014-11-19 14:28:49 +01:00
Anselm R Garbe
6d4fd01fc1 missed to remove old .hgtags 2014-11-14 16:07:17 +01:00
Anselm R Garbe
6703fe4592 applied 3 additional patches by Dimitris 2014-11-14 16:06:28 +01:00
Anselm R Garbe
5eaa0fff0d applied Eric's follow up patch 2014-11-12 11:18:50 +01:00
Anselm R Garbe
f87d3f5bef applied Eric's config.def.h patch 2014-11-02 09:23:48 +01:00
Anselm R Garbe
7cfa52d6eb version bump 2013-08-02 22:45:08 +02:00
Anselm R Garbe
16c1c2df60 fixed a silly bug, reported by several people, including Mark Edgar 2013-08-02 22:20:48 +02:00
Anselm R Garbe
fe525b3209 prepared a new release 2013-05-05 17:42:52 +02:00
Connor Lane Smith
a28f8b49c8 a few corrections to manpage 2012-04-20 00:15:32 +01:00
anselm@garbe.us
bade9ccb6c reversed the -u switch 2012-02-05 16:47:38 +01:00
garbeam@gmail.com
2831ca36c3 applied Quentin Carbonneaux's user patch 2012-01-22 18:27:17 +01:00
Anselm R Garbe
3b5d848cd4 applied Jeroen's manpage patch, thanks! 2011-04-08 12:51:16 +00:00
Anselm R Garbe
efb5435694 applied Dimitris patches, thanks 2011-03-06 07:37:21 +00:00
anselm@garbe.us
fdaf2adbc9 fixed issue reported by serge on irc, util.c was excluded in dist target 2010-08-06 09:52:12 +01:00
Kris Maglione
a4ba8e3b08 Added tag 1.1 for changeset d6140e3685b8 2010-05-25 12:03:25 -04:00
Anselm R Garbe
6af1b812ae cleanup 2010-05-14 18:01:20 +01:00
Anselm R Garbe
75d42255f2 applied anonymous cleanup patch, thanks anonymous! 2010-04-17 11:12:54 +01:00
Anselm R Garbe
dad75aa6ba removed debug line 2010-03-23 18:00:37 +00:00
anselm@garbe.us
d78d10d1a1 bugfix 2010-03-22 13:29:33 +00:00
Anselm R Garbe
1a4256ef71 merged kris' changes into mainstream sic 2009-11-28 12:16:35 +00:00
Anselm R Garbe
9c7027fcbf applied clamiax' patch for null messages 2009-10-30 09:34:59 +00:00
Kris Maglione
7f1961d4c6 Update sic/util.c to match sic.c tip. 2009-09-23 12:52:13 -04:00
Kris Maglione
2b85380411 Update kris/util.c strlcpy 2009-09-23 11:26:48 -04:00
Anselm R Garbe
14e430ac5b added kris' sic.c and util.c temporarily, will need some time to see what will and won't be integrated into mainstream sic.c 2009-09-23 14:32:20 +01:00
Anselm R Garbe
261dc71e58 applied portions of Mark Edgars patch 2009-09-23 14:21:03 +01:00
Anselm R Garbe
4a4f924fee applied Martin Kopta's splint patch 2009-08-07 08:37:09 +01:00
Anselm R Garbe
b3ed5f414f thanks to Matthias-Christian Ott for this hint 2009-02-21 19:14:13 +00:00
a@null
ca6ba9a64a applied Jeroen Schot's patch 2009-02-14 11:53:47 +00:00
a@null
f3827eec2a applied Matthias-Christian Ott's remark about trailing newlines 2009-02-14 11:42:45 +00:00
Anselm R Garbe
8b2eeee541 Added tag 1.0 for changeset b8794f3ed15e 2008-07-29 19:22:08 +01:00
Anselm R Garbe
2a372e2df1 made Makefile consistent 2008-07-29 19:18:03 +01:00
Anselm R Garbe
888ab22725 updated LICENSE 2008-07-29 19:11:07 +01:00
anselm@aab
8a58b25cb7 updated sic 2008-07-06 13:29:19 +01:00
Anselm R Garbe
589cce35c5 minor update 2008-07-02 21:29:57 +01:00
Anselm R. Garbe
5463bed7ed updating copyright notice in sic as well 2007-04-13 11:50:51 +02:00
Anselm R. Garbe
aa40ba1f3d applied a fix inspired by recent wmii commit 2007-02-21 11:00:12 +01:00
Anselm R. Garbe
ef99e720ff removed LD as well, this is misleading 2007-02-14 10:05:41 +01:00
Anselm R. Garbe
f9f6f8a19c Added tag 0.9 for changeset 96eb1bfede5b 2007-02-13 17:02:42 +01:00
Anselm R. Garbe
82946e102d setting the topic must not be supported, its a trivial IRC command (*and rarely used btw*) 2007-02-13 16:14:52 +01:00
arg@suckless.org
7ef7529687 I believe I have fixed the issue, why sic didn't handled PINGs correctly 2007-02-13 16:06:28 +01:00