Sign Up
Log In
Log In
or
Sign Up
Places
All Projects
Status Monitor
Collapse sidebar
openSUSE:13.1
libosmocore
0002-utils-avoid-breaking-strict-aliasing.patch
Overview
Repositories
Revisions
Requests
Users
Attributes
Meta
File 0002-utils-avoid-breaking-strict-aliasing.patch of Package libosmocore
From 6196f28b56b318ef312710dfa82d18a43ce6ae8e Mon Sep 17 00:00:00 2001 From: Jan Engelhardt <jengelh@inai.de> Date: Mon, 3 Jun 2013 01:40:57 +0200 Subject: [PATCH 2/2] utils: avoid breaking strict aliasing CC osmo-auc-gen.o osmo-auc-gen.c: In function 'main': osmo-auc-gen.c:217:3: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing] osmo-auc-gen.c:218:3: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing] osmo-auc-gen.c:219:3: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing] osmo-auc-gen.c:220:3: warning: dereferencing type-punned pointer will break strict-aliasing rules [-Wstrict-aliasing] --- utils/osmo-auc-gen.c | 14 ++++++++++---- 1 file changed, 10 insertions(+), 4 deletions(-) diff --git a/utils/osmo-auc-gen.c b/utils/osmo-auc-gen.c index 47256ff..1618211 100644 --- a/utils/osmo-auc-gen.c +++ b/utils/osmo-auc-gen.c @@ -213,12 +213,18 @@ int main(int argc, char **argv) } if (!rand_is_set) { + int r; + printf("WARNING: We're using really weak random numbers!\n\n"); srand(time(NULL)); - *(uint32_t *)&_rand[0] = rand(); - *(uint32_t *)(&_rand[4]) = rand(); - *(uint32_t *)(&_rand[8]) = rand(); - *(uint32_t *)(&_rand[12]) = rand(); + r = rand(); + memcpy(_rand, &r, sizeof(r)); + r = rand(); + memcpy(_rand + 4, &r, sizeof(r)); + r = rand(); + memcpy(_rand + 8, &r, sizeof(r)); + r = rand(); + memcpy(_rand + 12, &r, sizeof(r)); } if (test_aud.type == OSMO_AUTH_TYPE_NONE || -- 1.8.2
Locations
Projects
Search
Status Monitor
Help
OpenBuildService.org
Documentation
API Documentation
Code of Conduct
Contact
Support
@OBShq
Terms
openSUSE Build Service is sponsored by
The Open Build Service is an
openSUSE project
.
Sign Up
Log In
Places
Places
All Projects
Status Monitor