assert enum within range

This commit is contained in:
Eric House 2012-11-06 07:07:14 -08:00
parent 9981360c67
commit 9ad28908bb
2 changed files with 3 additions and 0 deletions

View file

@ -2316,6 +2316,7 @@ putDevID( const CommsCtxt* comms, XWStreamCtxt* stream )
# if XWRELAY_PROTO_VERSION >= XWRELAY_PROTO_VERSION_CLIENTID
DevIDType typ;
const XP_UCHAR* devID = util_getDevID( comms->util, &typ );
XP_ASSERT( ID_TYPE_NONE <= typ && typ < ID_TYPE_NTYPES );
stream_putU8( stream, typ );
if ( ID_TYPE_NONE != typ ) {
stream_catString( stream, devID );

View file

@ -110,6 +110,8 @@ typedef enum {
,ID_TYPE_RELAY /* assigned by relay as replacement for one of the below */
,ID_TYPE_LINUX
,ID_TYPE_ANDROID_GCM
,ID_TYPE_NTYPES
} DevIDType;
#ifndef CANT_DO_TYPEDEF