Commit Graph

297 Commits

Author SHA1 Message Date
orbitcowboy 6d681a0959 posix.cfg: Issue a warning in case a function accepting a file descriptor is called with a negative value. 2019-04-26 10:16:29 +02:00
orbitcowboy f288e18c2c posix.cfg: Added support for more interfaces. 2019-04-26 09:48:38 +02:00
orbitcowboy c4fb56e550 posix.cfg: Warn for socket/file-descriptors having negatives values. 2019-04-25 17:04:30 +02:00
orbitcowboy 4a91b7ec77 Merge branch 'master' of https://github.com/danmar/cppcheck 2019-04-25 16:58:47 +02:00
orbitcowboy df49b56a6f posix.cfg: Added support for openat(). Reference: http://man7.org/linux/man-pages/man2/openat.2.html 2019-04-25 16:56:22 +02:00
amai2012 9692c3dde7 Add macros from signal.h 2019-04-25 12:17:26 +02:00
orbitcowboy 751902da86 posix.cfg: Added more 'direction'-attributes. 2019-04-21 12:34:44 +02:00
orbitcowboy 45a3f679b4 posix.cfg: Improved configuration for close(). Issue a warning in case close is called with a file pointer having a negative value. 2019-04-21 12:28:17 +02:00
orbitcowboy a3b7524c84 posix.cfg: Added minsize attribute to pipe(). 2019-03-30 15:49:52 +01:00
Sebastian 432c04281a
Libraries: Move valloc() from std.cfg to posix.cfg. (#1743)
Move valloc() to posix.cfg since it is a legacy POSIX function and not
part of the standard (not even commonly used). It is not available in
msvc (Visual Studio).
2019-03-20 14:10:36 +01:00
Daniel Marjamäki 14528bcf25 Library: allowed values for the buffer-size attribute: malloc/calloc/strdup 2019-03-20 06:46:55 +01:00
Sebastian 19e9e42dd7
Library: Enhance minsize configuration and allow simple values. (#1736)
Some POSIX and Windows functions require buffers of at least some
specific size. This is now possible to configure via for example this
minsize configuration: `<minsize type="value" value="26"/>`.
The range for valid buffer size values is 1 to LLONG_MAX
(9223372036854775807)
2019-03-17 14:22:26 +01:00
versat 1b74bca973 posix.cfg: Further fixes/enhancements; adding more argument directions. 2019-03-12 13:35:06 +01:00
versat 12941721d2 posix.cfg: Further fixes/enhancements; adding more argument directions. 2019-03-12 11:41:10 +01:00
versat bb6874e4c1 posix.cfg: sched_*() functions: Enhance and add argument directions. 2019-03-12 09:17:43 +01:00
versat f21c3b13f1 posix.cfg: Further fixes/enhancements; adding more argument directions 2019-03-11 15:40:53 +01:00
versat 33e3ce232a posix.cfg: Fixes, enhancements and adding more argument directions.
Add `<use-retval/>` to htonl(), htons(), ntohl(), ntohs(), inet_addr()
and inet_ntoa().
Enhance argument configurations of message queue functions (mq_*()).
2019-03-11 14:11:47 +01:00
versat 7b958e788d posix.cfg: Fixes and adding more argument directions.
Fixes: The "length" argument of mmap*() and munmap() calls must be
greater than 0.
2019-03-11 11:20:07 +01:00
versat ecba3db9cc posix.cfg: Start specifying direction for arguments to functions.
There are still many functions with arguments that need a direction
specified.
2019-03-06 10:08:46 +01:00
orbitcowboy 831670c355 posix.cfg: Improved support for more macros and constants. 2019-02-17 23:35:34 +01:00
amai2012 b6681c2a2e Improve some function properties 2019-02-05 21:30:30 +01:00
orbitcowboy 2727a959b2 windows.cfg: Added missing <use-retval/>-tags for strcmp-functions. 2019-02-04 11:54:24 +01:00
orbitcowboy 6e72691986 posix.cfg: Added missing <use-retval/>-tags for strcmp-functions. 2019-02-04 08:27:49 +01:00
orbitcowboy acebfac176 Added missing <use-retval/>-tag to strdup()-like functions. In case the return value is not taken in account, a logical error is revealed. 2019-02-03 20:38:33 +01:00
amai2012 b69b0bf57e Small additions/corrections 2019-01-29 23:20:44 +01:00
amai2012 d6d8a871ca Add/correct some interfaces. Move some standard interfaces from gnu.cfg to posix.cfg. 2019-01-28 23:26:53 +01:00
amai2012 786ce0ac5c Add more interfaces to posix.cfg 2019-01-25 21:39:23 +01:00
amai2012 2515b015ea Improve configuration for bind() 2019-01-25 10:47:36 +01:00
amai2012 8f36b7d23b Add bind() to posix.cfg 2019-01-24 23:13:06 +01:00
amai2012 a0ee1d212b Fix parameter configuration for connect() 2019-01-23 15:33:37 +01:00
amai2012 44c12ccb31 Add connect() to posix.cfg 2019-01-22 21:51:04 +01:00
amai2012 2adf65968b posix.cfg: improve configuration for dlsym() 2019-01-12 21:50:02 +01:00
amai2012 400c6c8e76 Improve configuration for dlopen and add suitable test 2019-01-10 21:14:37 +01:00
amai2012 e5c7543a7d posix.cfg: add dlopen, dlsym, dlclose 2019-01-10 18:33:44 +01:00
yurii.putin 2aecd30cd8 Change cfg
Add some function (posix_memalign, reallocarray,aligned_alloc,valloc) to cfg. Add attribute format-str to some function.
2018-11-19 18:23:00 +01:00
Sebastian fc7aab220e
posix.cfg: Add some pthread_attr_* functions. (#1331)
References:
http://pubs.opengroup.org/onlinepubs/7908799/xsh/pthread_attr_setstacksize.html
http://pubs.opengroup.org/onlinepubs/7908799/xsh/pthread_attr_setguardsize.html
2018-08-08 12:22:09 +02:00
Sebastian f862cf603f
posix.cfg: Add some pthread_mutex_* functions. (#1320)
References:
http://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_mutex_init.html
http://pubs.opengroup.org/onlinepubs/9699919799/functions/pthread_mutex_lock.html
2018-07-21 17:52:12 +02:00
Sebastian 4ef452132c
posix.cfg,gnu.cfg: Add (get|set)hostname functions. (#1315)
Reference for POSIX gethostname:
http://pubs.opengroup.org/onlinepubs/9699919799/functions/gethostname.html
Reference for sethostname:
http://man7.org/linux/man-pages/man2/gethostname.2.html
2018-07-18 09:40:06 +02:00
orbitcowboy 335cb480bf posix.cfg: Added support for locale_t 2018-06-08 14:43:20 +02:00
Sebastian 50aa3620da
posix.cfg: Add minsize to readlink[at] function configurations (#1216) 2018-05-09 18:20:45 +02:00
Sebastian 90bc8b7404
posix.cfg: Add not-bool to last arguments where appropriate. (#1204)
Add not-bool function argument configuration where appropriate to catch errors like this: df4ca5fb72
2018-05-08 09:30:08 +02:00
amai2012 e8cccf842f Correct attributes for swab() 2018-03-20 11:40:50 +01:00
Daniel Marjamäki 7048f012a8 astyle formatting
[ci skip]
2018-03-19 20:33:36 +01:00
Daniel Marjamäki 7202787435 posix: remove function 'remove' that is also configured in std.cfg 2018-03-19 20:04:58 +01:00
Daniel Marjamäki 6b00ca33bd posix.cfg: Removed rename function as this is configured in std.cfg 2018-03-19 15:29:47 +01:00
amai2012 113f1efd72 Add configuration for swab() and sync() 2018-03-19 13:12:16 +01:00
Daniel Marjamäki 6e66150feb posix.cfg: update configuration for rename 2018-03-19 11:51:19 +01:00
Sebastian 7b02b45a76 posix library: Add strtok tests (#1069)
* posix library: Add strtok tests

In the posix library there is the same configuration for strtok but a
warning is added.

* posix.cfg: Remove redundant configuration for strtok, add comment.
2018-01-31 10:58:30 +01:00
Sebastian a4deca3c98 posix.cfg: Remove redundant entries (#1049)
I carefully removed the duplicate/redundant entries with less/missing
configuration, so no information is lost.
2018-01-22 17:21:07 +01:00
Sebastian b78d714037 posix.cfg: access(): Removed redundant configuration, added tests (#1048)
I intentionally removed the second access() configuraion because it was
missing the use-retval attribute. But calling access() without using the
return value is absolutely senseless.
I added tests to posix.c to verify the correct configuration of
access().
2018-01-22 14:54:14 +01:00
Sebastian de7aa8f513 Fix #7504: posix: open() was twice in configuration file (#1032)
* Fix #7504: posix: open() was twice in configuration file

This fixes ticket #7504: Problems with the open function were not always
detected because the open function was twice in posix.cfg and only the
second configuration was used by cppcheck. Like suggested now only
one configuration is used and the third parameter has a default value
and is thereby optional.
use-retval has been removed to avoid duplicate warnings because the
alloc/dealloc configuration already warns about unused retval.
According tests to verify that open is configured
correctly now have been added to test/cfg/posix.c.

* posix.cfg: open(): Add TODO for use-retval configuration
2018-01-18 13:56:36 +01:00
Sebastian 2e2f8a00d6 posix.cfg: Fix getprotobynumber configuration (#1034)
It seems to be a copy & paste error.
The comment, the return value, the warn entry and the rest of the
configuration suggest that this must be the getprotobynumber function
configuration and not the getservbyport configuration which would be
redundant as it is configured a bit later.
2018-01-16 10:46:30 +01:00
orbitcowboy d63897ff21 posix.cfg: Added support for stpncpy(). 2017-12-08 21:36:54 +01:00
orbitcowboy cdeb7fb25f posix.cfg: Added support for wcpncpy. 2017-12-08 21:28:48 +01:00
orbitcowboy 928727534a posix.cfg: Improved configuration for bcopy(): Warn for potential buffer access out of bounds issues. 2017-12-08 14:53:14 +01:00
orbitcowboy 1a4c25243c posix.cfg: Added more returnValue-types. 2017-10-05 11:38:11 +02:00
orbitcowboy c0f92b2409 posix.cfg: Added support for tcsendbreak. 2017-09-19 21:25:19 +02:00
orbitcowboy c4e2ca2996 posix.cfg: Added support of ioctl. 2017-09-19 21:12:03 +02:00
orbitcowboy 6d69845737 posix.cfg: Added support for some <termios.h>-functions. 2017-09-19 15:10:37 +02:00
orbitcowboy 40985ada14 posix.cfg: Added more returnValue-types. 2017-08-02 14:11:50 +02:00
orbitcowboy 4024420a4d posix.cfg: Added more returnValue-types and increased function support. 2017-08-02 09:26:16 +02:00
orbitcowboy d2698733c3 posix.cfg: Added returnValue-types for some functions. 2017-08-01 20:35:30 +02:00
orbitcowboy 39ca654519 posix.cfg: Fixed wrong index. The memory is allocated at the 4'th parameter. 2017-07-17 15:21:42 +02:00
orbitcowboy c62e46dc6e posix.cfg: Report memory leak when memory is allocated with getaddrinfo() and it is not freeded with freeaddrinfo(). 2017-07-17 15:17:20 +02:00
Alexander Mai 7a0f05aaa5 Correct some wrong attributes causing false positives. Add more interfaces 2017-06-08 22:33:41 +02:00
Alexander Mai d818b4ace1 Add more interfaces 2017-06-06 23:21:05 +02:00
Alexander Mai a350e6c7e8 Add more interfaces 2017-06-02 22:58:39 +02:00
alexander 49a28d00f9 Add some interfaces + small changes to existing ones 2017-05-29 00:47:24 +02:00
Alexander Mai 14be611a7e Correct configuration to allow NULL as 2nd argument to read/write. Whether it's a legal value depends on the 3rd argument 2017-04-29 17:57:16 +02:00
orbitcowboy 0b6c726439 posix.cfg: Do not allow the second parameter of read and write to be a NULL pointer. 2017-04-26 14:25:14 +02:00
amai2012 1d0b647072 #7915 false positive: "Memory leak" error after mmap return MAP_FAILED. define MAP_FAILED in posix.cfg. 2017-02-07 12:14:55 +01:00
alexander d846217641 #7906 false positive: (error) Null pointer dereference (tempnam) 2017-01-29 17:09:48 +01:00
orbitcowboy 6829a8da14 posix.cfg and windows.cfg: Added support for memccpy(). 2016-12-05 16:46:49 +01:00
orbitcowboy 7522b1b108 posix.cfg: Improved configuration by using <valid>-tags. 2016-12-05 10:30:11 +01:00
Daniel Marjamäki a5e214ab3f astyle formatting
[ci skip]
2016-12-04 19:15:32 +01:00
amai2012 abf59af87d Add a couple of interfaces 2016-12-04 12:24:26 +01:00
orbitcowboy 7b1ed9f415 windows.cfg and posix.cfg: Added more <use-retval/> configurations. 2016-11-28 16:58:33 +01:00
orbitcowboy 4130207edc posix.cfg and windows.cfg: Added support for more functions like _popen(). 2016-10-21 11:43:01 +02:00
orbitcowboy a7e8bcab62 posix.cfg: Improved support for getpwuid_r(). 2016-10-21 09:59:38 +02:00
orbitcowboy 466068f55d posix.cfg: added/updated getpwnam_r(), getgrent_r() and getpwuid_r(). 2016-10-18 17:01:05 +02:00
orbitcowboy db5e40b870 std.cfg: Added support for temnam_s; posix.cfg: Added support for fchmod. 2016-08-09 11:07:14 +02:00
Boris Egorov a0624344ce posix.cfg: Add more functions and comments 2016-08-04 21:07:26 +02:00
orbitcowboy e76518d800 posix.cfg: Added support for fnmatch. 2016-05-24 16:17:09 +02:00
orbitcowboy fd8fb9e4f4 cfg: Fixed FP recently introduced for fopen_s() and glob(). 2016-05-19 13:21:05 +02:00
orbitcowboy 0514e14cad posix.cfg: Added support for glob() and globfree(). 2016-05-19 11:51:49 +02:00
Alexander Mai b82bdb222a Correct library info for shmctl to avoid false positives 2016-01-30 18:14:08 +01:00
orbitcowboy 8ce813f241 posix.cfg: Added missing <leak-ignore>-tags. 2016-01-22 11:03:37 +01:00
orbitcowboy 8ea36fb6ec gnu.cfg,posix.cfg: Added support for more functions. 2016-01-22 10:40:04 +01:00
orbitcowboy b65873711a posix.cfg,gnu.cfg: Moved a few functions from posix to gnu. Improved the documentation. 2016-01-21 16:32:00 +01:00
orbitcowboy 1464990dad posix.cfg: Added more functions and comments. 2016-01-21 16:14:59 +01:00
orbitcowboy 82c663090e windows.cfg, posix.cfg: Added support for more functions. 2016-01-21 15:48:08 +01:00
Alexander Mai 161412dc31 Correct posix.cfg to avoid false positives. Fix runtests.sh 2016-01-15 00:11:48 +01:00
Boris Egorov 3c85791b6a posix.cfg: Only pointers can be null 2016-01-14 17:30:23 +06:00
orbitcowboy 023424f836 posix.cfg and gnu.cfg: Added support for more functions. 2016-01-13 11:57:21 +01:00
Alexander Mai 7802517a69 #7285 wrong var name: memset() called to fill 0 bytes of '&' memset with pointer: remove var name from message. Correct some entries in posix.cfg. 2016-01-12 23:20:48 +01:00
orbitcowboy b6fd9e2509 posix.cfg and windows.cfg: Added support for more functions. 2016-01-12 17:00:33 +01:00
Martin Ettl 9193e14b8f posix.cfg: Added support for the fileno() function. 2016-01-11 20:35:56 +01:00
orbitcowboy e03e9fbbcf posix.cfg: Added support for remove(). 2016-01-11 16:34:47 +01:00
orbitcowboy 2b3a12866a windows.cfg and posix.cfg: Added support for more functions, found by selfchecking cppchecks code. 2016-01-11 14:54:01 +01:00
PKEuS c15c61db00 Warn about usage of posix function mktemp (#3918). 2015-12-18 18:29:53 +01:00
orbitcowboy f84af529af Extended windows.cfg and posix.cfg about missing functions, found by using --check-library on some projects. 2015-11-25 11:02:32 +01:00
Daniel Marjamäki 9864f340f5 posix.cfg: reformatting using library editor 2015-11-22 13:34:40 +01:00
PKEuS 57d1196386 Replaced CheckNonReentrantFunctions and CheckObsoleteFunctions by generic CheckFunctions which is based on Library (#6529) 2015-11-22 09:18:07 +01:00
Daniel Marjamäki c62b23c4fc posix.cfg: saved with the Library Editor 2015-11-21 16:10:46 +01:00
orbitcowboy 66b9d8bf38 Improved testing of std.cfg and posix.cfg. 2015-09-10 11:50:47 +02:00
Alexander Mai 38ac8cd594 Fix some invalid attributes in library 2015-07-15 18:41:41 +02:00
orbitcowboy c4bcd6ec4c posix.cfg: Added support for more functions. 2015-07-14 09:21:57 +02:00
orbitcowboy 862361d807 posix.cfg and gnu.cfg: Added support for more functions. 2015-07-14 09:07:47 +02:00
Martin Ettl a8a11f2413 posix.cfg: Added support for more functions. 2015-04-19 00:13:30 +02:00
Martin Ettl b0e9805620 posix.cfg: Fixed wrong function name, introducted by my last commit. 2015-04-12 12:53:29 +02:00
Martin Ettl 47e949bc63 posix.cfg: Added support for more functions. 2015-04-12 10:42:16 +02:00
orbitcowboy 282f701989 posix.cfg: Added support for more functions. 2015-04-10 08:45:32 +02:00
orbitcowboy 6610b782cf posix.cfg: Added support for more functions. 2015-04-10 08:26:44 +02:00
Martin Ettl c73e0a82f8 posix.cfg: Added support for more functions. 2015-04-09 21:35:18 +02:00
Martin Ettl 8a3365c23e posix.cfg: Added missing open() and flock() functions. 2015-04-09 19:25:33 +02:00
Alexander Mai bacc5ac1cc Fix false positives ignoredReturnValue about some posix interfaces. Remove redundant strsignal() output from signal handler 2015-04-06 18:16:37 +02:00
Martin Ettl 435a5d0bf9 posix.cfg: Added support for uname(). 2015-04-05 23:23:39 +02:00
Martin Ettl 92c364ead8 posix.cfg: Added support for more functions. 2015-04-05 23:15:23 +02:00
Martin Ettl a16ed8f0e7 posix.cfg: Added support for more functions. std.cfg: Fixed mktime->mkxtime wrong naming and improved asctime() function checking. It is not allowed to provide a NULL pointer to asctime(). 2015-04-04 23:59:05 +02:00
Alexander Mai 42d9afe7de posix.cfg add more interfaces from stdlib.h. run astyle 2015-03-21 12:26:07 +01:00
orbitcowboy ce95776abc Reverted my previous commit 4139b6a818. 2015-03-16 10:39:08 +01:00
orbitcowboy 4139b6a818 posix.cfg: cleanup opened, but not closed <arg>-tags. 2015-03-16 09:06:16 +01:00
Alexander Mai cb6ed95ed3 posix.cfg: add more interfaces. Remove include from test which is missing on travis 2015-03-15 13:28:16 +01:00
Alexander Mai 3a690fd18e posix.cfg: fix false positive and add more interfaces 2015-03-15 12:56:24 +01:00
Alexander Mai 5b8d93efda posix.cfg: Fix false positives and add poll() 2015-03-14 23:31:56 +01:00
orbitcowboy 86a34db294 posix.cfg: Added more POSIX functions. 2015-03-12 12:06:14 +01:00
Alexander Mai 6bd7dd771d Add some functions from <time.h> to posix.cfg (see #6577) 2015-03-11 18:59:34 +01:00
orbitcowboy 5e8c646465 posix.cfg: Added support for more POSIX functions. 2015-03-10 14:40:12 +01:00
orbitcowboy 95923cbfea posix.cfg: Added missing podtype: timeval. 2015-03-09 09:12:15 +01:00
Martin Ettl 0839ce5a96 posix.cfg: Removed duplicate utime() function introduced by 841a27c19d. Added more test cases for uninitvar for utime() and utimes(). 2015-03-08 21:38:43 +01:00
Joshua Rogers 841a27c19d Add utime function to posix.cfg 2015-03-09 00:43:25 +11:00
Alexander Mai 39633ef26f Add more interfaces to posix.cfg 2015-03-08 14:24:54 +01:00
Alexander Mai 49099e78ff Add more string conversion functions to library files 2015-03-01 20:18:26 +01:00
Alexander Mai 6bfeb71dd2 Add more interfaces to gnu and posix libraries 2015-02-21 11:08:58 +01:00
Martin Ettl b12ebc1733 posix.cfg: utime() and utimes() second parameter is allowed to be NULL. 2015-02-20 22:43:48 +01:00
Alexander Mai 6d9eb6199d posix.cfg: add support for sched.h and 1 bugfix 2015-02-20 20:50:20 +01:00
Alexander Mai 6a7605271a Fix compiler warning. Add interfaces of POSIX passwd.h and pwd.h to posix.cfg 2015-02-18 20:56:44 +01:00
Daniel Marjamäki e5c098c7de TestUninitVar: move out posix.cfg testing 2015-02-17 18:08:19 +01:00
Alexander Mai 0a6babea74 #6181 Drop redundantGetAndSetUserId. Ensure (style-) warnings are issued if setuid()/getuid() and some related functions are ignored. Move strdupa()/strndupa() from posix.cfg to gnu.cfg 2015-02-16 22:19:51 +01:00
Daniel Marjamäki fe8ba51f03 TestMemLeak: moved posix.cfg tests 2015-02-15 18:11:09 +01:00
Thomas Jarosch 2da43035f4 Add openlog() / syslog() / vsyslog() to posix.cfg 2015-02-14 18:50:26 +01:00
orbitcowboy aa77abe1c6 posix.cfg: Added comment, no functional change. [ci skip]. 2015-02-11 14:27:29 +01:00
Martin Ettl 977fbc8030 posix.cfg: Added support for more podtypes. 2015-02-06 18:25:54 +01:00
Martin Ettl c676e34887 posix.cfg: Added more podtypes. 2015-02-05 17:44:51 +01:00
orbitcowboy d2552dd93a posix.cfg: declared usleep() as <leak-ignore/>. Improved support for <unistd.h> functions. 2015-02-05 14:18:08 +01:00
orbitcowboy f5a336d576 posix.cfg: Improved support for <unistd.h> functions. 2015-02-05 11:40:25 +01:00
orbitcowboy 5e3aa17a56 posix.cfg: Improved support for <unistd.h> functions. 2015-02-05 02:27:20 +01:00
orbitcowboy e6e8decd49 posix.cfg: Improved support for <unistd.h> functions. 2015-02-06 10:47:49 +01:00
orbitcowboy 84e831c21c posix.cfg: Improved support for functions from <unistd.h>. 2015-02-02 17:23:43 +01:00
orbitcowboy 8249be5859 Running astyle [ci skip]. 2015-02-02 10:26:21 +01:00