Project

General

Profile

Bug #7498

snprintf is incorrectly annotated with PRINTFLIKE1

Added by Prakash Surya over 3 years ago. Updated over 3 years ago.

Status:
Closed
Priority:
Low
Assignee:
Category:
cmd - userland programs
Start date:
2016-10-24
Due date:
% Done:

100%

Estimated time:
Difficulty:
Bite-size
Tags:
needs-triage
Gerrit CR:

Description

snprintf() is incorrectly annotated to be printf-like, because the first argument is indicated to be the format string, when in fact the 3rd argument is the format string. This annotation is used by lint to detect improper improper arguments passed to printf (when the format string is a string literal).

Thankfully, this mistake hasn't caused any errors to be introduced into the codebase, because the compiler (gcc -Wformat) also checks the arguments to snprintf (using a different, unknown mechanism to determine that the 3rd argument is the format string).

History

#1

Updated by Electric Monk over 3 years ago

  • % Done changed from 0 to 100
  • Status changed from New to Closed

git commit 3c5da275f68706f8301ea6c616a098430d84a71a

commit  3c5da275f68706f8301ea6c616a098430d84a71a
Author: Matthew Ahrens <mahrens@delphix.com>
Date:   2016-11-07T06:28:19.000Z

    7498 snprintf is incorrectly annotated with PRINTFLIKE1
    Reviewed by: Sebastien Roy <sebastien.roy@delphix.com>
    Reviewed by: George Wilson <george.wilson@delphix.com>
    Reviewed by: Robert Mustacchi <rm@joyent.com>
    Approved by: Gordon Ross <gordon.w.ross@gmail.com>

Also available in: Atom PDF