Go to file
Karel Kočí f2fd0bc148 libs/libc/obstack: revert invalid null byte append to obstack_vprintf
The commit c4d8d937d5 added null byte for
obstack_vprintf and thus to obstack_printf. I probably lost my marbles
but the same test I run previously now won't append null byte at the end
and this "fix" now causes regressions in code using obstack.

For the reference this is the testing code:

  #define _GNU_SOURCE
  #include <obstack.h>
  #include <stdarg.h>
  #include <stdio.h>
  #include <stdlib.h>

  #define obstack_chunk_alloc malloc
  #define obstack_chunk_free free

  static void print(struct obstack *obs, const char *fmt, ...) {
    va_list arg;
    va_start(arg, fmt);
    obstack_vprintf(obs, fmt, arg);
    va_end(arg);
  }

  int main(int argc, char *argv[]) {
    struct obstack obs;
    obstack_init(&obs);

    obstack_printf(&obs, "this %s", "text ");
    obstack_printf(&obs, "is appended");
    print(&obs, " as well as %s", "vprintf text");
    obstack_1grow(&obs, '\0');

    printf("%s\n", (char *)obstack_finish(&obs));

    obstack_free(&obs, NULL);
    return 0;
  }

The output on NuttX without this patch:

  > obstest
  this text

The output on NuttX with this patch:

  > obstest
  this text is appended as well as vprintf text

The output with GlibC:

  $ gcc test.c && ./a.out
  this text is appended as well as vprintf text
  $ ldd a.out
  	linux-vdso.so.1 (0x00007ffff7fc5000)
  	libc.so.6 => /nix/store/3dyw8dzj9ab4m8hv5dpyx7zii8d0w6fi-glibc-2.39-52/lib/libc.so.6 (0x00007ffff7dc8000)
  	/nix/store/3dyw8dzj9ab4m8hv5dpyx7zii8d0w6fi-glibc-2.39-52/lib/ld-linux-x86-64.so.2 => /nix/store/3dyw8dzj9ab4m8hv5dpyx7zii8d0w6fi-glibc-2.39-52/lib64/ld-linux-x86-64.so.2 (0x00007ffff7fc7000)

The output with Musl (and obstack_vprintf removed):

  $ gcc -lobstack test-musl.c && ./a.out
  this text is appended
  $ ldd a.out
  	/nix/store/00w9nz0343pxk7hbsjzq9bzaby65hk4g-musl-1.2.3/lib/ld-musl-x86_64.so.1 (0x7ffff7f4b000)
  	libobstack.so.1 => /nix/store/qvv16dqn85qwz9vz9wvpnv435z0n5msr-musl-obstack-1.2.3/lib/libobstack.so.1 (0x7ffff7f3b000)
  	libc.so => /nix/store/00w9nz0343pxk7hbsjzq9bzaby65hk4g-musl-1.2.3/lib/ld-musl-x86_64.so.1 (0x7ffff7f4b000)
2024-09-17 11:32:48 +08:00
.github build.yml: Limit the GitHub Runners 2024-09-13 14:33:13 +08:00
arch arch/x86_64: add basic support for R_X86_64_REX_GOTPCRELX relocation 2024-09-17 03:20:03 +08:00
audio Revert "build depend:Revert Make.dep intermediate ddc file" 2024-09-15 19:29:47 +08:00
binfmt fix two typos 2024-09-16 11:25:10 -03:00
boards boards/esp32s3: add support to esp32s3-lhcbit board 2024-09-17 01:30:44 +08:00
cmake cmake:enhance the module for adding extra libraries 2024-09-15 10:01:07 +08:00
crypto Revert "build depend:Revert Make.dep intermediate ddc file" 2024-09-15 19:29:47 +08:00
Documentation driver/pinctl: add pinctrl framework 2024-09-17 02:25:47 +08:00
drivers driver/pinctl: add pinctrl framework 2024-09-17 02:25:47 +08:00
dummy build: add initial cmake build system 2023-07-08 13:50:48 +08:00
fs vfs:fix a type mismatch issue and a typo 2024-09-16 11:24:56 -03:00
graphics Revert "build depend:Revert Make.dep intermediate ddc file" 2024-09-15 19:29:47 +08:00
include wqueue: extend the work_cancel_sync() return value 2024-09-17 02:56:39 +08:00
libs libs/libc/obstack: revert invalid null byte append to obstack_vprintf 2024-09-17 11:32:48 +08:00
mm Revert "build depend:Revert Make.dep intermediate ddc file" 2024-09-15 19:29:47 +08:00
net Revert "build depend:Revert Make.dep intermediate ddc file" 2024-09-15 19:29:47 +08:00
openamp Revert "build depend:Revert Make.dep intermediate ddc file" 2024-09-15 19:29:47 +08:00
pass1 Revert "build depend:Revert Make.dep intermediate ddc file" 2024-09-15 19:29:47 +08:00
sched sched/wqueue: Fix unexpected dq entry status 2024-09-17 02:56:39 +08:00
syscall Revert "build depend:Revert Make.dep intermediate ddc file" 2024-09-15 19:29:47 +08:00
tools Revert "build depend:Revert Make.dep intermediate ddc file" 2024-09-15 19:29:47 +08:00
video Revert "build depend:Revert Make.dep intermediate ddc file" 2024-09-15 19:29:47 +08:00
wireless Revert "build depend:Revert Make.dep intermediate ddc file" 2024-09-15 19:29:47 +08:00
.asf.yaml feat: add a GitHub action to lint the YAML files 2020-12-15 09:52:04 -06:00
.gitignore add .gdb_history to .gitignore 2024-09-14 12:14:12 +08:00
.pre-commit-config.yaml Created pre-commit config file 2024-08-19 21:40:56 +02:00
.yamllint feat: add a GitHub action to lint the YAML files 2020-12-15 09:52:04 -06:00
AUTHORS AUTHORS: add Tomek CEDRO to the list 2023-03-07 14:15:55 +01:00
CMakeLists.txt cmake:enhance the module for adding extra libraries 2024-09-15 10:01:07 +08:00
CONTRIBUTING.md Remove the tail spaces from all files except Documentation 2023-02-26 13:24:24 -08:00
INVIOLABLES.md
Kconfig coresight: add coresight_core 2024-09-13 09:09:19 +08:00
LICENSE libc/x86_64: port string functions from bionic 2024-07-02 23:59:18 +08:00
Makefile tools: migrate to SPDX identifier 2024-09-10 23:11:11 +08:00
NOTICE Remove the double blank line from source files 2022-02-20 20:10:14 +01:00
README.md Gathering community recommendations 2023-10-28 13:55:56 +08:00
ReleaseNotes Documentation: move ReleaseNotes 2023-09-26 20:41:00 +08:00

POSIX Badge License Issues Tracking Badge Contributors GitHub Build Badge Documentation Badge

Apache NuttX is a real-time operating system (RTOS) with an emphasis on standards compliance and small footprint. Scalable from 8-bit to 64-bit microcontroller environments, the primary governing standards in NuttX are POSIX and ANSI standards. Additional standard APIs from Unix and other common RTOSs (such as VxWorks) are adopted for functionality not available under these standards, or for functionality that is not appropriate for deeply-embedded environments (such as fork()).

For brevity, many parts of the documentation will refer to Apache NuttX as simply NuttX.

Getting Started

First time on NuttX? Read the Getting Started guide! If you don't have a board available, NuttX has its own simulator that you can run on terminal.

Documentation

You can find the current NuttX documentation on the Documentation Page.

Alternatively, you can build the documentation yourself by following the Documentation Build Instructions.

The old NuttX documentation is still available in the Apache wiki.

Supported Boards

NuttX supports a wide variety of platforms. See the full list on the Supported Platforms page.

Contributing

If you wish to contribute to the NuttX project, read the Contributing guidelines for information on Git usage, coding standard, workflow and the NuttX principles.

License

The code in this repository is under either the Apache 2 license, or a license compatible with the Apache 2 license. See the License Page for more information.