Skip to content

Commit

Permalink
Increased capacity of NetworkInfo.NetworkName buffer
Browse files Browse the repository at this point in the history
The previous limit of 30 bytes was not sufficient to decode longer
network names, limit has been increased to 40 bytes.

Also a debug warning will be issued if the network name cannot be
stored.

Fixes #415
  • Loading branch information
kstuart committed Jan 17, 2019
1 parent 123eef8 commit cbf6b53
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
6 changes: 4 additions & 2 deletions include/gammu-info.h
Expand Up @@ -130,9 +130,11 @@ typedef struct {
*/
char LAC[10];
/**
* Name of current network like returned from phone (or empty).
* Name of current network returned from phone (or empty).
* The buffer needs to have twice the capacity of the longest supported
* network name to account for decoding.
*/
unsigned char NetworkName[15 * 2];
unsigned char NetworkName[20 * 2];
/**
* GPRS state.
*/
Expand Down
1 change: 1 addition & 0 deletions libgammu/phone/at/atgen.c
Expand Up @@ -3209,6 +3209,7 @@ GSM_Error ATGEN_ReplyGetNetworkName(GSM_Protocol_Message *msg, GSM_StateMachine

/* Cleanup if something went wrong */
if (error != ERR_NONE) {
smprintf(s, "WARNING: Failed to store network name - ERROR(%s)", GSM_ErrorName(error));
NetworkInfo->NetworkName[0] = 0;
NetworkInfo->NetworkName[1] = 0;
}
Expand Down

0 comments on commit cbf6b53

Please sign in to comment.