[Bug 298192] sbin/bectl/bectl_jail.c: -Wformat-overflow issue reported by gcc14 in error path

From: <bugzilla-noreply_at_freebsd.org>
Date: Fri, 04 Sep 2026 21:25:39 UTC
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=298192

--- Comment #1 from Kyle Evans <kevans@freebsd.org> ---
(In reply to Enji Cooper from comment #0)

I'm sorry, but what on earth does that even mean?  The opt string is "bo:Uu:",
the -u argument is not optional and `fprintf` context is:

```
                case 'u':                                                       
                        if ((ret = jailparam_delarg(optarg)) == 0) {            
                                if (strcmp(optarg, "host.hostname") == 0)       
                                        default_hostname = true;                
                        } else if (ret != ENOENT) {                             
                                fprintf(stderr,                                 
                                    "bectl jail: error unsetting \"%s\"\n",     
                                    optarg);                                    
                                return (ret);                                   
                        }                                                       
                        break;                                                  
```

The implication would seem to be that `optarg` is NULL, but how does one come
to *that* conclusion?  Our getopt(3) guarantees that that isn't the case.  It's
not clear what I'm missing.

-- 
You are receiving this mail because:
You are the assignee for the bug.