Osmocom library for network/soecket abstraction and osmux audio multiplex https://osmocom.org/projects/libosmo-netif
Go to file
Pablo Neira Ayuso 14af167a55 osmux: fix buffer management mess in snprintf() calls
SNPRINTF_BUFFER_SIZE() looks too complex, previous version maintains two
different variables to account for the remaining space in the buffer,
one of them is always decremented based on what snprintf() returns,
which may result in underflow. These variables are swapped - not used
consistently - all over this code.

Replace this macro by a simplified version, with one single parameter to
account for remaining space. This macro also deals with two corner
cases:

1) snprintf() fails, actually never happens in practise, but
   documentation indicates it may return -1, so let's catch this case
   from here to stick to specs.

2) There is not enough space in the buffer, in that case, keep
   increasing offset, so we know how much would have been printed, just
   like snprintf() does.

Thanks to Pau Espin for reporting, and Holger for clues on this.
I have run osmux_test and, at quick glance, it looks good.

Change-Id: I5b5d6ec57a02f57c23b1ae86dbd894bad28ea797
2017-09-11 18:06:37 +00:00
contrib Use value string check from osmo-ci 2017-08-26 06:10:23 +00:00
debian deb: add missing dependency on doxygen 2017-04-27 11:32:38 +02:00
examples examples/stream-server.c: use read() rc instead of strlen() 2016-12-01 15:55:49 +00:00
include stream.h: Add missing stdint.h include 2017-05-02 07:26:30 +00:00
m4 initial commit 2011-10-04 02:36:46 +02:00
src osmux: fix buffer management mess in snprintf() calls 2017-09-11 18:06:37 +00:00
tests osmux: fix buffer management mess in snprintf() calls 2017-09-11 18:06:37 +00:00
.gitignore Add minimal doxygen documentation for stream + datagram modules 2017-04-08 20:13:14 +02:00
.gitreview Add gerrit settings 2016-12-22 14:06:35 +00:00
COPYING add COPYING file (GPLv2 license) 2011-10-05 13:43:25 +02:00
Doxyfile.in Add minimal doxygen documentation for stream + datagram modules 2017-04-08 20:13:14 +02:00
Makefile.am Use release helper from libosmocore 2017-08-28 10:53:35 +00:00
README.md README.md: Make sure all hyperlinks have <> 2017-03-17 21:30:33 +01:00
TODO-RELEASE Use release helper from libosmocore 2017-08-28 10:53:35 +00:00
configure.ac Use release helper from libosmocore 2017-08-28 10:53:35 +00:00
git-version-gen initial commit 2011-10-04 02:36:46 +02:00
libosmo-netif.pc.in build: use libosmo-netif.pc instead libosmonetif.pc 2012-02-23 19:51:01 +01:00

README.md

libosmo-netif- Osmocom network interface interface library

This repository contains a C-language library that form the basis of various higher-layer cellular communications protocol implementation. It implements stream server and clients for TCP, UDP, IPA as well as the non-standard/proprietary OSMUX protocol.

Homepage

The official homepage of the project is https://osmocom.org/projects/libosmo-netif

GIT Repository

You can clone from the official libosmo-netif.git repository using

git clone git://git.osmocom.org/libosmo-netif.git

There is a cgit interface at http://git.osmocom.org/libosmo-netif/

Documentation

There is no Doxygen-generated API documentation yet for this library. It would be great to some day have it, comparable to libosmocore.

Mailing List

Discussions related to libosmo-netif are happening on the openbsc@lists.osmocom.org mailing list, please see https://lists.osmocom.org/mailman/listinfo/openbsc for subscription options and the list archive.

Please observe the Osmocom Mailing List Rules when posting.

Contributing

Our coding standards are described at https://osmocom.org/projects/cellular-infrastructure/wiki/Coding_standards

We us a gerrit based patch submission/review process for managing contributions. Please see https://osmocom.org/projects/cellular-infrastructure/wiki/Gerrit for more details

The current patch queue for libosmo-netif can be seen at https://gerrit.osmocom.org/#/q/project:libosmo-netif+status:open