Re: disklabel: pointer deref fix

2021-01-30 Thread Todd C . Miller
On Sat, 30 Jan 2021 01:01:37 +0100, Christian Weisgerber wrote:

> Fix a pointer dereference in disklabel(8).
>
> This looks like somebody wrote *s[0] in place of (*s)[0].
> Which in this case happens to be equivalent, but it still looks
> wrong.

Probably my bug.  OK millert@

 - todd



disklabel: pointer deref fix

2021-01-29 Thread Christian Weisgerber
Fix a pointer dereference in disklabel(8).

This looks like somebody wrote *s[0] in place of (*s)[0].
Which in this case happens to be equivalent, but it still looks
wrong.

OK?

Index: sbin/disklabel/editor.c
===
RCS file: /cvs/src/sbin/disklabel/editor.c,v
retrieving revision 1.363
diff -u -p -U6 -r1.363 editor.c
--- sbin/disklabel/editor.c 19 Nov 2019 06:20:37 -  1.363
+++ sbin/disklabel/editor.c 29 Jan 2021 23:50:24 -
@@ -2374,22 +2374,22 @@ char *
 get_token(char **s, size_t *len)
 {
char*p, *r;
size_t   tlen = 0;
 
p = *s;
-   while (*len > 0 && !isspace((u_char)*s[0])) {
+   while (*len > 0 && !isspace((u_char)**s)) {
(*s)++;
(*len)--;
tlen++;
}
if (tlen == 0)
return (NULL);
 
/* eat whitespace */
-   while (*len > 0 && isspace((u_char)*s[0])) {
+   while (*len > 0 && isspace((u_char)**s)) {
(*s)++;
(*len)--;
}
 
if ((r = strndup(p, tlen)) == NULL)
err(1, NULL);
-- 
Christian "naddy" Weisgerber  na...@mips.inka.de