Project

General

Profile

Bug #2299 ยป snprintf.patch

Mathias Gibbens, 04/13/2015 11:08 AM

View differences:

daemon/face/ethernet-face.cpp
#include <pcap/pcap.h>
#include <cerrno> // for errno
#include <cstdio> // for std::snprintf()
#include <stdio.h>
#include <cstring> // for std::strerror() and std::strncpy()
#include <arpa/inet.h> // for htons() and ntohs()
#include <net/ethernet.h> // for struct ether_header
......
m_slicer.reset(new ndnlp::Slicer(m_interfaceMtu));
char filter[100];
std::snprintf(filter, sizeof(filter),
"(ether proto 0x%x) && (ether dst %s) && (not ether src %s)",
ethernet::ETHERTYPE_NDN,
m_destAddress.toString().c_str(),
m_srcAddress.toString().c_str());
// - std::snprintf not found in some environments
// http://redmine.named-data.net/issues/2299 for more information
snprintf(filter, sizeof(filter),
"(ether proto 0x%x) && (ether dst %s) && (not ether src %s)",
ethernet::ETHERTYPE_NDN,
m_destAddress.toString().c_str(),
m_srcAddress.toString().c_str());
setPacketFilter(filter);
if (!m_destAddress.isBroadcast() && !joinMulticastGroup())
    (1-1/1)